The strtof native AI script function is used to convert a string to a float. There are three different versions of this function available, depending on the desired output values.
(value: f)strtof(string: s) // strtof_s_f
(value: f, isfloat: f)strtof(string: s) // strtof_s_ff
(value: f, isfloat: f, isfull: f)strtof(string: s) // strtof_s_fff
The return values of the strtof function depend on which version of the function is used:
(val)strtof($str);
This example code calls the strtof function with a string variable $str
and returns the converted value as a float.
(val, isfloat)strtof($str);
This example code calls the strtof function with a string variable $str
and returns the converted value as a float, as well as a boolean indicating whether the input string contained a value.
(val, isfloat, isfull)strtof($str);
This example code calls the strtof function with a string variable $str
and returns the converted value as a float, as well as two booleans indicating whether the input string contained a value and whether it only contained the converted value.