Navigation: Language Reference > 13 - Built-in Functions >====== NUMERIC (return numeric string) ====== | ![]() ![]() ![]() |
NUMERIC(string)
NUMERIC | Validates all numeric string. |
string | A string constant, variable, or expression. |
The NUMERIC procedure returns the value 1 (true) if the string only contains a valid numeric value. It returns zero (false) if the string contains any non-numeric characters. Valid numeric characters are the digits 0 through 9, the letter “E” (see below), a leading minus sign, and a decimal point. DEFORMAT is used to return unformatted numbers from a formatted string.
A valid number may also be a REAL and hence the format of strings representing correct numerics can be one of the following:
[<;sign>]<;number>[.[<;number>]][e[<;sign>]<;number>]
[<;sign>].<;number>[e[<;sign>]<;number>]
where:
<;sign> - either minus (-) or plus (+) character
<;number> - definitive (non-empty) sequence of decimal digits
e - either “e” or “E” character
Return Data Type: | UNSIGNED |
Example:
!NUMERIC('1234.56') returns 1
!NUMERIC('1,234.56') returns 0
!NUMERIC('-1234.56') returns 1
!NUMERIC('1234.56-') returns 0
IF NOT NUMERIC(PartNumber) !If part number is not numeric
DO ChkValidPart !check for valid part number
END !End if
See Also: