User Tools

Site Tools


syntax:functions:asnumber

AsNumber(value)

This function converts the value to number. This is useful when you wish to validate the contents of a field or retrieve the number value of a field.

  • Text should have only digits and one decimal point.
  • Boolean is converted into -1 (TRUE) or 0 (FALSE).
  • Number remains itself.
  • Everything else returns error.
Example Result
asnumber( '123.45' ) 123.45
asnumber( 543.21 ) 543.21
asnumber( 1 > 2 ) 0
asnumber( 'text' ) #Can't convert to number

See also

syntax/functions/asnumber.txt · Last modified: 2015/04/19 03:05 by dmitry