|
dataType
>>-dataType-+--------+-----------------------------------------><
+-(type)-+
Returns NUM if you specify no argument
and the receiving string
is a valid Rexx number that can be added to 0 without error. It returns
CHAR if the receiving string is not a
valid number.
If you specify
[type]
, it returns
1 if the receiving
string matches the type. Otherwise, it returns
0. If the receiving
string is null, the method returns 0
(except when the
[type]
is
X or B,
for which [dataType]
returns 1 for
a null string). The following are valid
[type]
s. You need to specify
only the capitalized letter, or the number of the last type listed. The language
processor ignores all characters surrounding it.
| Alphanumeric |
returns 1 if the receiving
string contains only characters from the ranges
a-z,
A-Z, and
0-9.
|
| Binary |
returns 1 if the receiving
string contains only the characters 0 or
1, or whitespace. Whitespace characters can
appear only between groups of 4 binary characters. It also returns 1 if string
is a null string, which is a valid binary string.
|
| Lowercase |
returns 1 if the receiving
string contains only characters from the range
a-z.
|
| Mixed case |
returns 1 if the receiving
string contains only characters from the ranges
a-z and
A-Z.
|
| Number |
returns 1 if
receiving_string~dataType returns
NUM.
|
| lOgical |
returns 1 if
the receiving string is exactly "0" or "1". Otherwise it returns
0.
|
| Symbol |
returns 1 if the receiving
string is a valid symbol, that is, if SYMBOL(string) does not return
BAD. (See
.)
Note that both uppercase and lowercase alphabetic characters are permitted.
|
| Uppercase |
returns 1 if the receiving
string contains only characters from the range
A-Z.
|
| Variable |
returns 1 if the receiving
string could appear on the left-hand
side of an assignment without causing a SYNTAX condition.
|
| Whole number |
returns 1 if the receiving
string is a whole number under the current setting of NUMERIC DIGITS.
|
| heXadecimal |
returns 1 if the receiving
string contains only characters from the ranges
a-f,
A-F,
0-9, and
whitespace characters (as long as whitespace characters appear only between
pairs of hexadecimal characters). Also returns
1 if
the receiving string is a null string.
|
| 9 Digits |
returns 1 if
receiving_string~dataType("W") returns
1 when NUMERIC DIGITS is set to 9.
|
String class - datatype method
" 12 "~dataType -> "NUM"
""~dataType -> "CHAR"
"123*"~dataType -> "CHAR"
"12.3"~dataType("N") -> 1
"12.3"~dataType("W") -> 0
"Fred"~dataType("M") -> 1
""~dataType("M") -> 0
"Fred"~dataType("L") -> 0
"?20K"~dataType("s") -> 1
"BCd3"~dataType("X") -> 1
"BC d3"~dataType("X") -> 1
"1"~dataType("O") -> 1
"11"~dataType("O") -> 0
Note
The [dataType]
method tests the meaning or type of characters in a
string, independent of the encoding of those characters (for example, ASCII
or EBCDIC).
|