User Tools

Site Tools


syntax:functions:asnumber

This is an old revision of the document!


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( 0 - 13 ) -13
asnumber( 2 + 2 = 4 ) -1
asnumber( 1 > 2 ) 0
asnumber( 'text' ) #Can't convert to number
asnumber( ) #Can't convert to number

See also

syntax/functions/asnumber.1429324706.txt.gz · Last modified: 2015/04/17 22:38 by elenap

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki