char-upcase, char-downcase, char-foldcase, char-titlecase - case conversion


(import (rnrs))                     ;R6RS
(import (rnrs unicode))             ;R6RS
(import (scheme r5rs))              ;R7RS
(import (scheme char))              ;R7RS


(char-upcase char)
(char-downcase char)
(char-foldcase char)
(char-titlecase char)               ;R6RS


These procedures take a character argument and return a character result.
If the argument is an upper-case or title-case character, and if there is a single character that is its lower-case form, then char-downcase returns that character.
If the argument is a lower-case or title-case character, and there is a single character that is its upper-case form, then char-upcase returns that character.
If the character has a case-folded character, then char-foldcase returns that character. Otherwise the character returned is the same as the argument. For Turkic characters İ (#\x130) and ı (#\x131), char-foldcase behaves as the identity function; otherwise char-foldcase is the same as char-downcase composed with char-upcase.
If the argument is a lower-case or upper-case character, and there is a single character that is its title-case form, then char-titlecase returns that character. If the argument is not a title-case character and there is no single character that is its title-case form, then char-titlecase returns the upper-case form of the argument.

R7RS notes that language-sensitive folding and casing pairs are not used.


Returns a single character object.


(char-upcase #\i)     =>  #\I
(char-downcase #\i)   =>  #\i
(char-titlecase #\i)  =>  #\I
(char-foldcase #\i)   =>  #\i
;; The following might not be supported in R7RS implementations.
(char-upcase #\ß)     =>  #\ß
(char-downcase #\ß)   =>  #\ß
(char-titlecase #\ß)  =>  #\ß
(char-foldcase #\ß)   =>  #\ß
(char-upcase #\Σ)     =>  #\Σ
(char-downcase #\Σ)   =>  #\σ
(char-titlecase #\Σ)  =>  #\Σ
(char-foldcase #\Σ)   =>  #\σ
(char-upcase #\ς)     =>  #\Σ
(char-downcase #\ς)   =>  #\ς
(char-titlecase #\ς)  =>  #\Σ
(char-foldcase #\ς)   =>  #\σ


R5RS and earlier reports do not have char-foldcase and char-titlecase. R7RS does not have char-titlecase. R7RS implementations may or may not support Unicode, but they are required to support ASCII.

In R6RS implementations and other implementations that support Unicode, the behavior of these procedures depends on the supported Unicode version.


This procedure can raise exceptions with the following condition types:
&assertion (R6RS)
The wrong number of arguments was passed or an argument was outside its domain.
The assertions described above are errors. Implementations may signal an error, extend the procedure's domain of definition to include such arguments, or fail catastrophically.


char-upper-case?(3scm), char-lower-case?(3scm)


R4RS, IEEE Scheme, R5RS, R6RS, R7RS


R5RS and earlier reports make no provisions for Unicode. ASCII is mentioned but implementations may even run on EBCDIC. Implementations of R5RS may support Unicode, but historically many implementations used ISO-8859-n and other character sets which are now subsets of Unicode.


This page is part of the scheme-manpages project. It includes materials from the RnRS documents. More information can be found at

Markup created by unroff 1.0sc,    March 04, 2023.