Next: , Previous: , Up: Conversion Functions   [Contents][Index]

15.4.3 atoi

The standard function atoi provides the following interface:

fun atoi = (string str, int base = 10) long: { … }

It parses a signed integral number in the given base in the string str and returns it as a signed 64-bit integer.

The accepted values for base are 2, 8, 10 (the default) and 16. If any other base is requested an E_inval exception is raised.

Note that atoi allows for extra information to be stored in str after the parsed integer. Thus, this works:

(poke) atoi ("10foo")