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( '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.1429412713.txt.gz · Last modified: 2015/04/18 23:05 by dmitry