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


21.4.4 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 the same as for ‘strtoi’. See strtoi for a list of supported bases.

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

(poke) atoi ("10foo")
10L