toDouble
This function is used by Ignition's Expression language.
Description​
Tries to coerce value into a double (64-bit floating point value). If value is a number, the conversion is direct. If value is a string, it is parsed to see if it represents a double. If not, type casting fails.
Syntax​
toDouble(value, [failover])
Parameters​
Type | Parameter | Description |
---|---|---|
Object | value | The value to type cast. |
Object | failover | The failover value if type casting fails. [optional] |
Results​
Double - The value type cast as a double.
Examples​
Code Snippet
toDouble("38.772") //returns 38.772
Code Snippet
toDouble({Root Container.TextField.text}, 0.0) //returns the value in the text box as a double, or 0.0 if the value doesn't represent a number.