~ chicken-core (master) /manual/Module (scheme char)
Trap1[[tags: manual]]2[[toc:]]34== Module (scheme char)56R7RS Operations on characters.78<procedure>(char-ci=? char[1] char[2] char[3] ...)</procedure><br>9<procedure>(char-ci>? char[1] char[2] char[3] ...)</procedure><br>10<procedure>(char-ci<? char[1] char[2] char[3] ...)</procedure><br>11<procedure>(char-ci>=? char[1] char[2] char[3] ...)</procedure><br>12<procedure>(char-ci<=? char[1] char[2] char[3] ...)</procedure><br>1314These procedures are similar to char=? et cetera, but they treat upper case15and lower case letters as the same. For example, {{(char-ci=? #\A #\a)}} returns16#t.1718Specifically, these procedures behave as if char-foldcase were applied to their19arguments before they were compared.2021<procedure>(char-alphabetic? char)</procedure><br>22<procedure>(char-numeric? char)</procedure><br>23<procedure>(char-whitespace? char)</procedure><br>24<procedure>(char-upper-case? letter)</procedure><br>25<procedure>(char-lower-case? letter)</procedure><br>2627These procedures return #t if their arguments are alphabetic, numeric,28whitespace, upper case, or lower case characters, respectively, otherwise they29return #f. Specifically, they must return #t when applied to characters with30the Unicode properties Alphabetic, Numeric_Type=Decimal, White_Space,31Uppercase, and Lowercase respectively, and #f when applied to any other Unicode32characters. Note that many Unicode characters are alphabetic but neither upper33nor lower case.3435<procedure>(digit-value char)</procedure>3637This procedure returns the numeric value (0 to 9) of its argument if it is a38numeric digit (that is, if char-numeric? returns #t), or #f on any other39character.4041 (digit-value #\3) ==> 342 (digit-value #\x0664) ==> 443 (digit-value #\x0AE6) ==> 044 (digit-value #\x0EA6) ==> #f4546<procedure>(char-upcase char)</procedure><br>47<procedure>(char-downcase char)</procedure><br>48<procedure>(char-foldcase char)</procedure><br>4950The char-upcase procedure, given an argument that is the lowercase part of a51Unicode casing pair, returns the uppercase member of the pair. Note that52language-sensitive casing pairs are not used. If the argument is not the53lowercase member of such a pair, it is returned.5455The char-downcase procedure, given an argument that is the uppercase part of a56Unicode casing pair, returns the lowercase member of the pair. Note that57language-sensitive casing pairs are not used. If the argument is not the58uppercase member of such a pair, it is returned.5960The char-foldcase procedure applies the Unicode simple case-folding algorithm61to its argument and returns the result. Note that language-sensitive folding is62not used. If the character that results from folding is not supported by the63implementation, the argument is returned. See UAX #44 (part of the Unicode64Standard) for details.6566Note that many Unicode lowercase characters do not have uppercase equivalents.6768<procedure>(string-ci=? string[1] string[2] string[3] ...)</procedure><br>69<procedure>(string-ci<? string[1] string[2] string[3] ...)</procedure><br>70<procedure>(string-ci>? string[1] string[2] string[3] ...)</procedure><br>71<procedure>(string-ci<=? string[1] string[2] string[3] ...)</procedure><br>72<procedure>(string-ci>=? string[1] string[2] string[3] ...)</procedure><br>7374The "-ci" procedures behave as if they applied string-foldcase to their75arguments before invoking the corresponding procedures without “-ci”.7677<procedure>(string-upcase string)</procedure><br>78<procedure>(string-downcase string)</procedure><br>79<procedure>(string-foldcase string)</procedure><br>8081These procedures apply the Unicode full string uppercasing, lowercasing, and82case-folding algorithms to their arguments and return the result. In certain83cases, the result differs in length from the argument. If the result is equal84to the argument in the sense of string=?, the argument may be returned. Note85that language-sensitive mappings and foldings are not used. The Unicode86Standard prescribes special treatment of the Greek letter Σ, whose normal87lower-case form is σ but which becomes ς at the end of a word. See UAX #4488(part of the Unicode Standard) for details. However, implementations of89string-downcase are not required to provide this behavior, and may choose to90change Σ to σ in all cases.9192---93Previous: [[Module (scheme case-lambda)]]9495Next: [[Module (scheme complex)]]