4.5 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.
修改于package base的6.1.1.8版本:Updated from Unicode 5.0.1 to Unicode 7.0.0.
4.5.1 Characters and Scalar Values
函数
(char->integer char) → exact-integer?
char : char?
> (char->integer #\A) 65
函数
(integer->char k) → char?
k :
(and/c exact-integer? (or/c (integer-in 0 55295) (integer-in 57344 1114111)))
> (integer->char 65) #\A
函数
(char-utf-8-length char) → (integer-in 1 6)
char : char?
4.5.2 Character Comparisons
修改于package base的7.0.0.13版本:Allow one argument, in addition to allowing two or more.
修改于package base的7.0.0.13版本:Allow one argument, in addition to allowing two or more.
修改于package base的7.0.0.13版本:Allow one argument, in addition to allowing two or more.
修改于package base的7.0.0.13版本:Allow one argument, in addition to allowing two or more.
修改于package base的7.0.0.13版本:Allow one argument, in addition to allowing two or more.
修改于package base的7.0.0.13版本:Allow one argument, in addition to allowing two or more.
修改于package base的7.0.0.13版本:Allow one argument, in addition to allowing two or more.
函数
(char-ci<=? char1 char2 ...) → boolean?
char1 : char? char2 : char?
> (char-ci<=? #\A #\a) #t
> (char-ci<=? #\a #\A) #t
> (char-ci<=? #\a #\b #\b) #t
修改于package base的7.0.0.13版本:Allow one argument, in addition to allowing two or more.
修改于package base的7.0.0.13版本:Allow one argument, in addition to allowing two or more.
函数
(char-ci>=? char1 char2 ...) → boolean?
char1 : char? char2 : char?
> (char-ci>=? #\A #\a) #t
> (char-ci>=? #\a #\A) #t
> (char-ci>=? #\c #\b #\b) #t
修改于package base的7.0.0.13版本:Allow one argument, in addition to allowing two or more.
4.5.3 Classifications
函数
(char-alphabetic? char) → boolean?
char : char?
函数
(char-lower-case? char) → boolean?
char : char?
函数
(char-upper-case? char) → boolean?
char : char?
函数
(char-title-case? char) → boolean?
char : char?
函数
(char-numeric? char) → boolean?
char : char?
函数
(char-symbolic? char) → boolean?
char : char?
函数
(char-punctuation? char) → boolean?
char : char?
函数
(char-graphic? char) → boolean?
char : char?
函数
(char-whitespace? char) → boolean?
char : char?
函数
(char-blank? char) → boolean?
char : char?
函数
(char-iso-control? char) → boolean?
char : char?
函数
(char-general-category char) → symbol?
char : char?
4.5.4 Character Conversions
函数
(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).
> (char-upcase #\a) #\A
> (char-upcase #\λ) #\Λ
> (char-upcase #\space) #\space
函数
(char-downcase char) → char?
char : char?
> (char-downcase #\A) #\a
> (char-downcase #\Λ) #\λ
> (char-downcase #\space) #\space
函数
(char-titlecase char) → char?
char : char?
> (char-upcase #\a) #\A
> (char-upcase #\λ) #\Λ
> (char-upcase #\space) #\space
函数
(char-foldcase char) → char?
char : char?
> (char-foldcase #\A) #\a
> (char-foldcase #\Σ) #\σ
> (char-foldcase #\ς) #\σ
> (char-foldcase #\space) #\space