ToNumber
The ToNumber function converts a value of any type to numeric.
Definition
ToNumber(valor)Parameters
| Name | Description | Data type |
|---|---|---|
| valor | Value to convert to numeric. If the value is a string, it will be converted to the equivalent number. If the string contains decimals, the separator must always be a period. If the value is boolean, 1 will be returned when the value is true, and 0 when the value is false. If the value is already numeric, it will be returned unchanged. | any |
String to number conversion example
The following example converts a text value to a number.
ToNumber('-123.45')The result is -123.45 (numeric).
Boolean to number conversion example
ToNumber(true)The result is 1 (numeric).