NexJ Logo

ToNumber()

Converts the specified value to a number. This function takes a Boolean, number, or string value as an argument and returns a number value. If a string value is provided as the argument, the string must contain only numeric digits that can be interpreted as a number.

Syntax

ToNumber(<value_to_convert>)

Input

value_to_convert

Boolean, number, string, null

The value to convert to a number.

Output

number

Examples

  • The expression ToNumber(3) returns 3.0.
  • The expression ToNumber(3.14) returns 3.14.
  • The expression ToNumber("3.14") returns 3.14.
  • The expression ToNumber(TRUE) returns 1.0.