Characters and codes are not genuine data types in Jekejeke Prolog. Characters are simply atoms of code length one and codes are integer values in the range 0 to 0x10FFFF. Atoms are internally represented as sequences of 16-bit words. Codes in the range above 16-bit are represented as surrogate pairs. It is permitted to have single standing surrogates in an atom. It is also permitted to have surrogates in escape sequences.

Examples:?- char_code('\xDBFF\\xDFFF\',X).

X = 1114111

?- char_code(X,1114111).

X = '\x10FFFF\'

?- char_code('\x10FFFF\',X).

X = 1114111

Besides the ISO core standard inspired atom related predicates we also provide Prolog commons inspired atom related predicates. The predicate atom_split/3 allows concatenating and splitting atom lists to and from atoms. The predicate atom_number/2 allows converting between atoms and numbers.

Examples:?- atom_split(X, '_', [a,b,c]).

X = a_b_c

?- atom_split(a_b_c, '_', X).

X = [a,b,c]

The arguments of the below string predicates do not work with 16-bit word units. The arguments are measured in code units. This results in a certain performance penalty. For example the length of an atom is not anymore a one shot operation, but instead the whole atom has to be scanned to compute the length. Similar conversions apply to offsets.

The following string predicates are provided:

- atom_length(X, Y): [ISO 8.16.1]
- The predicate succeeds when Y is the length of the atom X.
- atom_concat(X, Y, Z): [ISO 8.16.2]
- The predicate succeeds whenever the atom Z is the concatenation of the atom X and the atom Y.
- sub_atom(X, Y, Z, U):
- sub_atom(X, Y, Z, T, U): [ISO 8.16.3]
- The predicate succeeds whenever the atom U is the sub atom of the atom X starting at position Y with length Z and ending T characters before.
- atom_chars(X, Y): [ISO 8.16.4]
- If X is a variable and Y is a character list then the predicate succeeds when X unifies with the corresponding atom. Otherwise if X is an atom then the predicate succeeds when Y unifies with the corresponding character list.
- atom_codes(X, Y): [ISO 8.16.5]
- If X is a variable and Y is a code list then the predicate
succeeds when X unifies with the corresponding atom. Otherwise
if X is an atom then the predicate succeeds when Y unifies with
the corresponding code list.

- char_code(X, Y): [ISO 8.16.6]
- If X is a variable and if Y is a code then the predicate succeeds when X unifies with the corresponding character. Otherwise if X is a character then the predicate succeeds when Y unifies with the corresponding code.
- number_chars(X, Y): [ISO 8.16.7]
- If X is a variable and Y is a character list then the predicate succeeds when X unifies with the corresponding number. Otherwise if X is a number then the predicate succeeds when Y unifies with the corresponding character list.
- number_codes(X, Y): [ISO 8.16.8]
- If X is a variable and Y is a code list then the predicate succeeds when X unifies with the corresponding number. Otherwise if X is a number then the predicate suceeds when Y unifies with the corresponding code list.
**integer_chars(X, R, Y):**- If Y is ground and Y is a character list then the predicate succeeds when X unifies with corresponding integer in base R. Otherwise if X is an integer then the predicate succeeds when Y unifies with the corresponding character list in base R.
**integer_codes(X, R, Y):**- If Y is ground and Y is a code list then the predicate
succeeds when X unifies with corresponding integer in base R.
Otherwise if X is an integer then the predicate succeeds when Y
unifies with the corresponding code list in base R.

**last_atom_concat(X, Y, Z):**- The predicate succeeds whenever the atom Z is the concatenation of the atom X and the atom Y. Works like the ISO predicate atom_concat/3 except that non-deterministic results are enumerated in reverse order.
**last_sub_atom(X, Z, T, U):****last_sub_atom(X, Y, Z, T, U):**- The predicate succeeds whenever the atom U is the sub atom of the atom X starting at position Y with length Z and ending T characters before. Works like the ISO predicate sub_atom/5 except th^at non-deterministic results are enumerated in reverse order.
**atom_split(L, S, R): [Prolog Commons Atom Utilities]**

- If R is a variable the predicate succeeds when R unifies with the concatenation of each atom from the non-empty list L separated by the atom S. Otherwise the predicate splits the atom R into a list L of atoms that are separated by the atom S.
**atom_number(A, N): [Prolog Commons Atom Utilities]**- If A is a variable, then the predicate succeeds in A with the number unparsing of N. Otherwise the predicate succeeds in N with the number parsing of A.
**atom_integer(A, R, N):**- If A is a variable, then the predicate succeeds in A with the
integer unparsing of N in base R. Otherwise the predicate
succeeds in N with the integer parsing of A in base R.

**atom_block(A, B):**- If A is a variable, then the predicate succeeds in A with the
atom for the block B. Otherwise the predicate succeeds in B with
the atom for the block B.

**term_atom(T, A):**

term_atom(T, A, O):

- The predicate succeeds when A is the serialization of the term T. The ternary predicate accepts read respectively write options O.

- max_code:
- The legal value is an integer. The value gives the maximum value of a character code. Default value is 0x10FFFF. The value cannot be changed.