atoi
atoi(t_string[t] ) =>x_result/nil
Description
Converts a string into an integer. Returns nil if the given string does not denote an integer.
The atoi function calls the C library function strtol to convert a string into an integer. It returns nil if t_string does not represent an integer.
Arguments
|
If t_string includes any non-numeric characters, this argument enforces that |
Value Returned
Examples
atoi("123")
=> 123
atoi("abc")
=> nil
atoi("123.456")
=> 123
atoi("123abc")
=> 123
atoi("12.01.01")
=> 12.01
atoi("12.01.01" t)
=> nil
Related Topics
Return to top