4.5 Characters
Characters in The Racket Guide introduces characters.
Characters range over Unicode scalar values, which includes characters whose values range from #x0 to #x10FFFF, but not including #xD800 to #xDFFF. The scalar values are a subset of the Unicode code points.
Two characters are eqv? if they correspond to the same scalar value. For each scalar value less than 256, character values that are eqv? are also eq?. Characters produced by the default reader are interned in read-syntax mode.
See Reading Characters for information on reading characters and Printing Characters for information on printing characters.
4.5.1 Characters and Scalar Values
procedure
(char->integer char) → exact-integer?
char : char?
Example: | ||
|
procedure
(integer->char k) → char?
k :
(and/c exact-integer? (or/c (integer-in 0 55295) (integer-in 57344 1114111)))
Example: | ||
|
procedure
(char-utf-8-length char) → (integer-in 1 6)
char : char?
4.5.2 Character Comparisons
Examples: | ||||
|
Examples: | ||||||
|
Examples: | ||||||
|
Examples: | ||||||
|
Examples: | ||||||
|
Examples: | ||||
|
Examples: | ||||||
|
procedure
(char-ci<=? char1 char2 ...+) → boolean?
char1 : char? char2 : char?
Examples: | ||||||
|
Examples: | ||||||
|
procedure
(char-ci>=? char1 char2 ...+) → boolean?
char1 : char? char2 : char?
Examples: | ||||||
|
4.5.3 Classifications
procedure
(char-alphabetic? char) → boolean?
char : char?
procedure
(char-lower-case? char) → boolean?
char : char?
procedure
(char-upper-case? char) → boolean?
char : char?
procedure
(char-title-case? char) → boolean?
char : char?
procedure
(char-numeric? char) → boolean?
char : char?
procedure
(char-symbolic? char) → boolean?
char : char?
procedure
(char-punctuation? char) → boolean?
char : char?
procedure
(char-graphic? char) → boolean?
char : char?
procedure
(char-whitespace? char) → boolean?
char : char?
procedure
(char-blank? char) → boolean?
char : char?
procedure
(char-iso-control? char) → boolean?
char : char?
procedure
(char-general-category char) → symbol?
char : char?
procedure
→
(listof (list/c exact-nonnegative-integer? exact-nonnegative-integer? boolean?))
4.5.4 Character Conversions
procedure
(char-upcase char) → char?
char : char?
String procedures, such as string-upcase, handle the case where Unicode defines a locale-independent mapping from the code point to a code-point sequence (in addition to the 1-1 mapping on scalar values).
Examples: | ||||||
|
procedure
(char-downcase char) → char?
char : char?
Examples: | ||||||
|
procedure
(char-titlecase char) → char?
char : char?
Examples: | ||||||
|
procedure
(char-foldcase char) → char?
char : char?
Examples: | ||||||||
|