number_chars(?Number, ?Chars)

Chars is the list of character codes comprising the printed representation of Number. Initially, either Number must be instantiated to a number, or Chars must be instantiated to a proper list of character codes.

If Number is initially instantiated to a number, Chars is unified with the list of character codes that make up its printed representation. If Number is uninstantiated and Chars is initially instantiated to a list of characters that corresponds to the correct syntax of a number (either integer or float), Number is bound to that number; otherwise number_chars/2 will simply fail. If the arguments to number_chars/2 are both uninstantiated, it signals an error.

number_chars/2 was built into the system in Release 2.0. Before that, it was a library predicate. library(strings) still contains the old code under the name number_chars1/2.