sitelogo
number_codes/2

relates a number and the list of the codes of the one-character atoms forming that number.

number_codes(+Number, -List)
number_codes(-Number, +List)

If Number is a number and List is a variable then List will be unified with the list of character codes whose elements correspond to the sequence of characters of the textual representation of Number.
If Number is a variable then List must be a list of character codes. The concatenation of the characters corresponding to the character codes must be parsable as number. Number will be unified with the resulting number.

Arguments

Number                 number
List                   list of integers (between 0 and 255)

Examples

number_codes(1234, L). Succeeds with substitution L <- [49, 50, 51, 52]
number_codes(N, [50, 55, 46, 49, 49]). Succeeds with substitution N <- 27.11
number_codes(14.3, [49, X, 46, Y]). Succeeds with substitution X <- 52, Y <- 51

Standard

This predicate is part of the ISO-Prolog Standard.

See also

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


Darueber read on...
scroll to top managed with ubiCMS