User Tools

Site Tools


syntax:functions:asnumber

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Next revisionBoth sides next revision
syntax:functions:asnumber [2015/01/29 22:23] – created dmitrysyntax:functions:asnumber [2015/04/18 23:04] dmitry
Line 1: Line 1:
 ===== AsNumber(value) ===== ===== AsNumber(value) =====
  
-Converts the //value// to number.+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.+  * 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.
  
-Boolean is converted into -(trueor 0 (false).+^  Example  ^  Result 
 +| asnumber( 0 13 )  |  -13  | 
 +| asnumber1 > 2  |   | 
 +| asnumber'text'   #Can't convert to number  |
  
-Number remains itself. 
  
-Everything else returns error.+ 
 + 
 +=== See also === 
 +  * [[syntax:functions:astext| AsText(value)]]
syntax/functions/asnumber.txt · Last modified: 2021/09/12 12:13 by craigt

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki