Added (char-upcase)

This commit is contained in:
Justin Ethier 2015-03-25 23:02:31 -04:00
parent 8be0c02a06
commit 11d861a97c

View file

@ -72,6 +72,13 @@
(define (char>? c1 c2 . cs) (Cyc-bin-op-char > c1 (cons c2 cs)))
(define (char<=? c1 c2 . cs) (Cyc-bin-op-char <= c1 (cons c2 cs)))
(define (char>=? c1 c2 . cs) (Cyc-bin-op-char >= c1 (cons c2 cs)))
(define (char-upcase c)
(if (char-lower-case? c)
(integer->char
(- (char->integer c)
(- (char->integer #\a)
(char->integer #\A))))
c))
(define (char-alphabetic? c) (and (char>=? c #\A) (char<=? c #\z))) ;; ASCII-only
(define (char-upper-case? c) (and (char>=? c #\A) (char<=? c #\Z))) ;; ASCII-only
(define (char-lower-case? c) (and (char>=? c #\a) (char<=? c #\z))) ;; ASCII-only