mes: Add char-downcase, char-upcase.

* mes/module/srfi/srfi-14.mes (char-downcase, char-upcase): New
function.
This commit is contained in:
Jan Nieuwenhuizen 2018-11-11 10:10:43 +01:00
parent b7f5e1a8f9
commit 9543962ece
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
1 changed files with 12 additions and 0 deletions

View File

@ -76,3 +76,15 @@
(define (char-set-copy cs)
(map identity cs))
(define (char-upcase c)
(if (char-set-contains? char-set:lower-case c) (integer->char (- (char->integer c)
(- (char->integer #\a)
(char->integer #\A))))
c))
(define (char-downcase c)
(if (char-set-contains? char-set:upper-case c) (integer->char (+ (char->integer c)
(- (char->integer #\a)
(char->integer #\A))))
c))