This structure adds a few functions to work directly on the single-byte encodings of ASCII code points. All character class predicates returns false on bytes which are parts of non-ASCII characters. For general processing of natural language texts, use a Unicode library.
The original Char structure is not included here, see Unprime_char for a full replacement.
val is_ascii : char -> bool
Maps a character to true iff its code is in the interval [0, 127].
val is_ascii_graph : char -> bool
True on characters normally rendered as non-blank glyphs; that is all non-space printable characters.
val is_ascii_cntrl : char -> bool
True for control characters in the ASCII range.
val is_ascii_space : char -> bool
Maps space, tab, NL, CR, VT, FF to true, everything else to false.
val is_ascii_digit : char -> bool
True on latin digits '0' to '9', false elsewhere.
val is_xdigit : char -> bool
True on hexadecimal digits, false elsewhere.
val is_ascii_lower : char -> bool
True on ASCII lower-case letters 'a' to 'z', false elsewhere.
val is_ascii_upper : char -> bool
True on ASCII upper-case letters 'A' to 'Z', false elsewhere.
val is_ascii_alpha : char -> bool
True on ASCII letters, false elsewhere.
val is_ascii_alnum : char -> bool
True on ASCII letters and digits, false elsewhere.
val is_ascii_punct : char -> bool
True on non-alphanumeric ASCII graphic characters, false elsewhere.