Description
Reports whether the value of a string is a number.
Syntax
IsNumber ( string )
Argument |
Description |
---|---|
string |
A string whose value you want to test to determine whether it is a valid PowerScript number |
Return value
Boolean.
Returns true if string is a valid PowerScript number and false if it is not. If string is null, IsNumber returns null.
Usage
Use IsNumber to check that text in an edit control can be converted to a number.
To convert a string to a specific numeric datatype, use the Double, Dec, Integer, Long, or Real function.
When using IsNumber, it is important to note that the return value is influenced by the number formatting in the regional settings, particularly the "Decimal symbol" and "Digit grouping symbol".
-
"Decimal Symbol" -- IsNumber recognizes the decimal point based on the selected regional settings. For example, in some countries, a comma may be used as the decimal symbol.
-
"Digit Grouping Symbol" -- IsNumber ignores digit grouping symbols. For instance, if the digit grouping symbol is set to a comma, IsNumber will return true for values like "123,456" and "12343434,45673434".
Examples
This statement returns true:
IsNumber("32.65")
This statement returns false:
IsNumber("A16")
If the SingleLineEdit sle_Age contains 32, these statements store 32 in li_YearsOld:
integer li_YearsOld IF IsNumber(sle_Age.Text) THEN li_YearsOld = Integer(sle_Age.Text) END IF
See also
IsNumber method for DataWindows in IsNumber in DataWindow Reference in DataWindow Reference.