string-upcase, string-downcase, string-titlecase, string-foldcase - string case conversion
(import (rnrs)) ;R6RS
(import (rnrs unicode)) ;R6RS
(import (scheme char)) ;R7RS
(string-titlecase string) ;R6RS
Returns a case-converted version of
Converts a string to upper case.
Converts a string to lower case.
Converts the string to its case-folded counterpart, using the full
case-folding mapping, but without the special mappings for Turkic
Converts the first cased character of each word, and downcases all
other cased characters.
These procedures are defined in terms of Unicode's locale-independent
case mappings from Unicode scalar-value sequences to scalar-value
sequences. In particular, the length of the result string can be
different from the length of the input string.
Since these procedures are locale-independent, they may not be
appropriate for some locales.
The Unicode Standard prescribes special treatment of the Greek letter
Σ, whose normal lower-case form is σ but which becomes ς at the end of
a word. See Unicode Standard Annex #44 for details.
However, implementations of
are not required to provide this behavior, and may choose to change Σ
to σ in all cases.
The case mappings needed for implementing these procedures can be
extracted from UnicodeData.txt, SpecialCasing.txt,
WordBreakProperty.txt, and CaseFolding.txt from the Unicode
Word breaking, as needed for the correct casing of Σ and for
string-titlecase, is specified in Unicode Standard Annex #29.
These procedures return a single value; a string.
When the specified
result is equal in the sense of
to the argument, these procedures may return the argument instead of a
newly allocated string.
(string-upcase "Hi") => "HI"
(string-downcase "Hi") => "hi"
(string-foldcase "Hi") => "hi"
(string-upcase "Straße") => "STRASSE"
(string-downcase "Straße") => "straße"
(string-foldcase "Straße") => "strasse"
(string-downcase "STRASSE") => "strasse"
(string-downcase "Σ") => "σ"
;; Chi Alpha Omicron Sigma.
;; See the note on R7RS in the description.
(string-upcase "XAOΣ") => "XAOΣ"
(string-downcase "XAOΣ") => "χαoς"
(string-downcase "XAOΣΣ") => "χαoσς"
(string-downcase "XAOΣ Σ") => "χαoς σ"
(string-foldcase "XAOΣΣ") => "χαoσσ"
(string-upcase "χαoς") => "XAOΣ"
(string-upcase "χαoσ") => "XAOΣ"
(string-titlecase "kNock KNoCK") => "Knock Knock"
(string-titlecase "who's there?") => "Who's There?"
(string-titlecase "r6rs") => "R6rs"
(string-titlecase "R6RS") => "R6rs"
In R6RS implementations, case conversion differs according to which
Unicode version is supported. R7RS does not have
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.
https://www.unicode.org/reports/tr44/Unicode Standard Annex #44: Unicode Character Database.
https://www.unicode.org/reports/tr29/Unicode Standard Annex #29: Unicode Text Segmentation.
The first Scheme report with these procedures is R6RS. They were later
also added in R7RS, except for
This page is part of the
It includes materials from the RnRS documents.
More information can be found at
Markup created by unroff 1.0sc, March 04, 2023.