NUM(), NUMS() |
![]() ![]() ![]() |
The NUM() function tests whether a string can be converted to a number. The NUMS() function is similar to NUM() but operates on successive elements of a dynamic array, returning a similarly structured dynamic array of results.
Format
NUM(string)
where
The NUM() function returns true (1) if the string can be converted to a number. The function returns false (0) for a string which cannot be converted to a number. A null string is a valid representation of zero and hence causes NUM() to return true.
Example
LOOP DISPLAY "Enter part number ": INPUT PART.NO UNTIL LEN(PART.NO) AND NUM(PART.NO) PRINTERR "Part number is invalid" REPEAT
This program fragment prompts for and inputs a part number. If the data entered is null or cannot be converted to a number, an error message is displayed and the prompt is repeated. |