Availability:built-in
<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 <wctype.h>
, e.g., alnum
uses iswalnum(). The types prolog_var_start
, prolog_atom_start
,
prolog_identifier_continue
and prolog_symbol
are 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.
- alnum
- Char is a letter (upper- or lowercase) or digit.
- alpha
- Char is a letter (upper- or lowercase).
- csym
- Char is a letter (upper- or lowercase), digit or the
underscore (
_
). These are valid C and Prolog symbol characters. - csymf
- Char is a letter (upper- or lowercase) or the underscore (
_
). These are valid first characters for C and Prolog symbols. - ascii
- Char is a 7-bit ASCII character (0..127).
- white
- Char is a space or tab, i.e. white space inside a line.
- cntrl
- Char is an ASCII control character (0..31), ASCII DEL character (127), or non-ASCII character in the range 128..159 or 8232..8233.
- digit
- Char is a digit, i.e., Char is in 0 ....
See also
decimal
. - digit(Weight)
- Char is a digit with value Weight. I.e.
char_type(X, digit(6))
yields X =’6'
. Useful for parsing numbers. - xdigit(Weight)
- Char is a hexadecimal digit with value Weight.
I.e.
char_type(a, xdigit(X))
yields X =’10'
. Useful for parsing numbers. - decimal
- Char is a decimal digit in any script. This implies it has the Unicode general category Nd).
- decimal(Weight)
- Char is a decimal digit in any script with Weight 0 ....
- Char is printable character.
- graph
- Char produces a visible mark on a page when printed. Note that the space is not included!
- lower
- Char is a lowercase letter.
- lower(Upper)
- Char is a lowercase version of Upper. Only true if Char is lowercase and Upper uppercase.
- to_lower(Upper)
- 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.
- upper
- Char is an uppercase letter.
- upper(Lower)
- Char is an uppercase version of Lower. Only true if Char is uppercase and Lower lowercase.
- to_upper(Lower)
- 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.
- punct
- Char is a punctuation character. This is a
graph
character that is not a letter or digit. - space
- Char is some form of layout character (tab, vertical tab, newline, etc.).
- end_of_file
- Char is -1.
- end_of_line
- Char ends a line (ASCII: 10..13).
- newline
- Char is a newline character (10).
- period
- Char counts as the end of a sentence (.,!,?).
- quote
- Char is a quote character (
"
,'
,`
). - paren(Close)
- Char is an open parenthesis and Close is the corresponding close parenthesis.
- prolog_var_start
- Char can start a Prolog variable name.
- prolog_atom_start
- Char can start a unquoted Prolog atom that is not a symbol.
- prolog_identifier_continue
- Char can continue a Prolog variable name or atom.
- prolog_symbol
- Char is a Prolog symbol character. Sequences of Prolog symbol
characters glue together to form an unquoted atom. Examples are
,=..
, etc.\=