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