String.to_number
String.to_number
Function
Convert a string to a numeric value according to BT relaxed numeric rules.
Syntax
string.to_number()
Parameters
No parameters.
Return value
| Type | Description |
|---|---|
| Int/Float/Null | Returns Int when it can be parsed into an integer, Float when it can be parsed into a floating point number, and Null when it cannot be parsed. |
Example
text = '42' result = text.to_number() // Output: 42 print result
Notes
- The original string will not be modified.