Domain: Variable access/test functions
The IS-INTEGER( ) function checks whether the expression specified as a string represents an integer:
The string may consist only of digits 0 through 9 and the signs + and -.
The sign + or - must be placed directly in front of the number, i.e. the signs and corresponding numbers should not be separated by blanks.
The value of the expression must lie within the valid range of -231 to 231-1.
Blanks are permitted at the beginning and end of the string, i.e. the string can be filled with right- or left-justified blanks. If the checked string contains an integer, it can, for example, be subsequently converted with the INTEGER( ) function.
Format
IS-INTEGER( ) |
STRING = string_expression |
Result type
BOOLEAN
Input parameters
STRING = string_expression
Designates the string to be checked for integers.
Result
TRUE
The string contains an integer, i.e. it can be converted to an integer value.
FALSE
The string does not contain an integer.
Example
/A = IS-INTEGER (STRING = ' -123') /SHOW-VARIABLE A A = TRUE /B = IS-INTEGER(STRING = '+(123-3)') /SHOW-VARIABLE B B = FALSE
In the first case, the string contains an integer value. The included blanks are permitted. The result is therefore: A = TRUE. In the second case, the string contains an expression, not an integer value. The result is therefore: B = FALSE.