Next: Strings Up: Basic Data Extensions Previous: Numbers

# Characters

MzScheme character values range over the characters for ``extended ASCII'' values 0 to 255 (where the ASCII extensions are platform-specific). The procedure `char->integer` returns the extended ASCII value of a character and `integer->char` takes an extended ASCII value and returns the corresponding character. If `integer->char` is given an integer that is not in 0 to 255 inclusive, the `exn:application:type` exception is raised.

The procedures `char->latin-1-integer` and `latin-1-integer->char` support conversions between characters in the platform-specific character set and platform-independent Latin-1 (ISO 8859-1) values:

- `(char->latin-1-integer char)` returns the integer in 0 to 255 inclusive corresponding to the Latin-1 value for char, or `#f` if char (in the platform-specific character set) has no corresponding character in Latin-1.
- `(latin-1-integer->char k)` returns the character corresponding to the Latin-1 mapping of k, or `#f` if the platform-specific character set does not support the corresponding Latin-1 character. If k is not in 0 to 255 inclusive, the `exn:application:type` exception is raised.

For Unix and BeOS, `char->latin-1-integer` and `latin-1-integer->char` are the same as `char->integer` and `integer->char`. For Windows, the platform-specific set and Latin-1 match except for the range `#x80` to `#x9F` (which are unprintable control characters in Latin-1). For MacOS, the mapping between Latin-1 and the platform-specific character set (``MacRoman'') is complex, and several printable characters in each set have no corresponding character in the other set.

The character comparison procedures -- `char=?`, `char-ci=?`, etc. -- take one or more character arguments and check the arguments pairwise (like the numerical comparison procedures).