SWI-Prolog offers two comprehensive predicates for classifying characters and character codes. These predicates are defined as built-in predicates to exploit the C-character classification's handling of locale (handling of local character sets). These predicates are fast, logical and deterministic if applicable.
In addition, there is the library
providing compatibility with some other Prolog systems. The predicates
of this library are defined in terms of code_type/2.
_). These are valid C and Prolog symbol characters.
_). These are valid first characters for C and Prolog symbols.
char_type(X, digit(6)yields X =
'6'. Useful for parsing numbers.
char_type(a, xdigit(X)yields X =
'10'. Useful for parsing numbers.
graphcharacter that is not a letter or digit.
There is nothing in the Prolog standard for converting case in textual data. The SWI-Prolog predicates code_type/2 and char_type/2 can be used to test and convert individual characters. We have started some additional support:
\u0020) character. Out uses the same conventions as with_output_to/2 and format/3.
This section deals with predicates for language-specific string comparison operations.
The Key is an implementation-defined and generally unreadable string. On systems that do not support locale handling, Key is simply unified with Atom.