atom_codes/2

defines a relation between an atom and a list of the codes of one-character atoms.

atom_codes(+Atom, -List)
atom_codes(-Atom, +List)

If Atom is an atom then atom_codes/2 explodes Atom into a list of character codes.
If Atom is a variable then List must be a list of character codes. atom_codes/2 converts the character codes to characters and concatenates these characters to the atom Atom.

Arguments

Atom                  atom
List                  list of charactercodes (between 0'\u0000 and 0'\uffff)

Examples

atom_codes(abcde, L). Succeeds with substitution L <- [97, 98, 99, 100, 101].
atom_codes(A, [108,105,116,117]). Succeeds with substitution A <- list.
atom_codes(list, [108,I,116,T]). Succeeds with substitution I <- 105, T<- 117.

Standard

This predicate is part of the ISO-Prolog Standard.

See also

atom_chars/2, atom_concat/3, atom_length/2, atom_number/2, char_code/2, number_chars/2, number_codes/2, parse_atom/2/3, sub_atom/5.


Up read on...