toInt
lib.toInt
Docs pulled from | This Revision | about 1 hour ago
Parse a string as an int. Does not support parsing of integers with preceding zero due to ambiguity between zero-padded and octal numbers. See toIntBase10.
Inputs
str
- A string to be interpreted as an int.
Type
toInt :: string -> int
Examples
lib.strings.toInt
usage example
toInt "1337"
=> 1337
toInt "-4"
=> -4
toInt " 123 "
=> 123
toInt "00024"
=> error: Ambiguity in interpretation of 00024 between octal and zero padded integer.
toInt "3.14"
=> error: floating point JSON numbers are not supported