tonumber
stringParses a string as a number
Syntax
tonumber(string) Parameters
string (string) The string to parse as a number
Returns
number Numeric value parsed from the string
Examples
Input:
tonumber("123") Output:
123 Input:
tonumber("3.14") Output:
3.14 Input:
"42" | tonumber Output:
42 The tonumber() function parses a string and converts it to a numeric value. This is useful for converting string data to numbers for mathematical operations.
Usage
Use tonumber() when you need to convert string representations of numbers into actual numeric values, such as when processing text-based data files or user input.