to_integer

Definition: integer res = to_integer(string s, integer def_value = 0)
Description: Converts a string representation of an unsigned decimal integer into an integer.

s: A string such as "42".
def_value: The value to return on failure.

Returns the integer equivalent of s, or def_value.
Comments: This is, quite deliberately, the simplest possible implementation of such a function.

To deal with values outside 0..1,073,741,823 as well as signs, fractions, exponents, embedded underscores, or other number bases, use to_number().

This routine is defined in builtins/to_int.e (an autoinclude).
Example:
?to_integer("12")                           -- 12
?to_integer("-12")                          -- 0 (the default def_value)