The Ciao system provides builtin predicates which allow conversions between constants (atomic terms, i.e., atoms or numbers) and their string representation (character code lists). Note that sometimes strings are more suitable to handle sequences of characters.
String is the list of the ASCII codes of the characters comprising the name of Const. Note that if Const is an atom whose name can be interpreted as a number (e.g. '96'), the predicate is not reversible, as that atom will not be constructed when Const is uninstantiated. Thus it is recommended that new programs use the ISO-compliant predicates atom_codes/2 or number_codes/2, as these predicates do not have this inconsistency.
Usage 1:
Usage 2:
If String can be interpreted as a number, Const is unified with that number, otherwise with the atom whose name is String.
String is the list of the ASCII codes of the characters comprising the name of Atom.
Usage 1:
Usage 2:
String is the list of the ASCII codes of the characters comprising a representation of Number.
Usage 1:
Usage 2:
String is the list of the ASCII codes of the characters comprising a representation of Number in base Base.
Usage 1:
Usage 2:
Atom can be read as a representation of Number.
Usage 1:
Usage 2:
Atom can be read as a representation of Number in base Base.
Usage 1:
Usage 2:
Length is the number of characters forming the name of Atom.
Usage:
Atom_12 is the result of concatenating Atom_1 followed by Atom_2.
Usage 1:
Concatenate two atoms.
Usage 2:
Non-deterministically split an atom.
Usage 3:
Take out of an atom a certain suffix (or fail if it cannot be done).
Usage 4:
Take out of an atom a certain prefix (or fail if it cannot be done).
Sub_atom is formed with Length consecutive characters of Atom after the Before character. For example, the goal sub_atom(summer,1,4,umme) succeeds.
Usage: