Availability:built-in
number_string(?Number,
?String)Bi-directional conversion between a number and a string. At least one of
the two arguments must be instantiated. Besides the type used to
represent the text, this predicate differs in several ways from its ISO
cousin:149Note that SWI-Prolog's
syntax for numbers is not ISO compatible either.
- If String does not represent a number, the predicate fails
rather than throwing a syntax error exception.
- Leading white space and Prolog comments are not allowed.
- Numbers may start with '+' or '-'.
- It is not allowed to have white space between a leading '+'
or '-' and the number.
- Floating point numbers in exponential notation do not require a dot
before exponent, i.e.,
"1e10"
is a valid number.