atoi
ASCII to integer converter.
Syntax
atoi(str_expr)
Argument
- str_expr
- A valid numeric string.
Example
Templex Expression | Result |
---|---|
{atoi("1.23")} |
1.23 |
{atoi("12")} |
12 |
{atoi("12a")} |
12 |
{atoi("dog")} |
0 |
Comments
The atoi function converts a string to a scalar with the same value as the numeric value represented by the string.
If str_expr contains none of the characters 0 through 9, the result is 0.
If str_expr contains only the characters 0 through 9, a minus sign (-), or a decimal point (.), the result is a scalar with the same value as the numeric value represented by the string.
If str_expr contains other characters in addition to the characters 0 through 9, a minus sign (-), or a decimal point (.), the result is a scalar with the same value as the numeric value represented by the string. The invalid characters are ignored.
atoi is included only for backward compatibility with Filler.