<ctype.h>primitives. The types are sensititve to the active locale, see setlocale/3. Most of the Types are mapped to the Unicode classification functions from
alnumuses iswalnum(). The types
prolog_symbolare based on the locale-independent built-in classification routines that are also used by read/1 and friends.
Note that the mode (-,+) is only efficient if the Type has
a parameter, e.g.,
char_type(C, digit(8)). If Type
is a atomic, the whole unicode range (0..0x1ffff) is generated and
tested against the character classification function.
- Char is a letter (upper- or lowercase) or digit.
- Char is a letter (upper- or lowercase).
- Char is a letter (upper- or lowercase), digit or the
_). These are valid C and Prolog symbol characters.
- Char is a letter (upper- or lowercase) or the underscore (
_). These are valid first characters for C and Prolog symbols.
- Char is a 7-bit ASCII character (0..127).
- Char is a space or tab, i.e. white space inside a line.
- Char is an ASCII control character (0..31), ASCII DEL character (127), or non-ASCII character in the range 128..159 or 8232..8233.
- Char is a digit.
- Char is a digit with value Weight. I.e.
char_type(X, digit(6))yields X =
’6'. Useful for parsing numbers.
- Char is a hexadecimal digit with value Weight.
char_type(a, xdigit(X))yields X =
’10'. Useful for parsing numbers.
- Char produces a visible mark on a page when printed. Note that the space is not included!
- Char is a lowercase letter.
- Char is a lowercase version of Upper. Only true if Char is lowercase and Upper uppercase.
- Char is a lowercase version of Upper. For non-letters, or letter without case, Char and Lower are the same. See also upcase_atom/2 and downcase_atom/2.
- Char is an uppercase letter.
- Char is an uppercase version of Lower. Only true if Char is uppercase and Lower lowercase.
- Char is an uppercase version of Lower. For non-letters, or letter without case, Char and Lower are the same. See also upcase_atom/2 and downcase_atom/2.
- Char is a punctuation character. This is a
graphcharacter that is not a letter or digit.
- Char is some form of layout character (tab, vertical tab, newline, etc.).
- Char is -1.
- Char ends a line (ASCII: 10..13).
- Char is a newline character (10).
- Char counts as the end of a sentence (.,!,?).
- Char is a quote character (
- Char is an open parenthesis and Close is the corresponding close parenthesis.
- Char can start a Prolog variable name.
- Char can start a unquoted Prolog atom that is not a symbol.
- Char can continue a Prolog variable name or atom.
- Char is a Prolog symbol character. Sequences of Prolog symbol
characters glue together to form an unquoted atom. Examples are