$AlphNum
The $AlphNum function verifies whether a string is composed only of characters that are valid in the specified (or default) language, and digits 0 through 9.
Syntax
%result = $AlphNum(string[,language])
%result | A numeric variable that contains:
|
---|---|
string | The string to be verified. string must be one of the following:
|
language | An optional string that specifies the language to use. language is handled as follows:
|
Examples
The following example illustrates the string and language arguments as literals enclosed in quotation marks:
Function code... | Returns... |
---|---|
$alphnum ('JOHN','US') |
1 |
$alphnum ('MÂCON','FRENCHC') |
1 |
$alphnum ('MÂCON','US') |
0 |
$alphnum ('JOHN SMITH','US') |
0 |
$alphnum ('ÎLE D'ORLÉANS','FRENCHC') |
0 |
$alphnum ('12A','US') |
1 |
$alphnum ('12A','FRENCHC') |
1 |
In the following example, the request sorts by name and processes records whose designated field value does not meet the $AlphNum criteria. The second argument in the $AlphNum call instructs Model 204 to use French Canadian to perform the validation:
BEGIN %SEARCH = $READ('ENTER FIELD NAME') FIND.RECS: FIND ALL RECORDS FOR WHICH RECTYPE = POLICYHOLDER END FIND PLACE RECORDS IN FIND.RECS ON LIST BAD FOR EACH RECORD IN FIND.RECS IF $alphnum(%%SEARCH,'FRENCHC') THEN REMOVE RECORD FROM LIST BAD END IF END FOR SORT.RECS: SORT RECORDS ON LIST BAD BY FULLNAME FOR EACH RECORD IN SORT.RECS . . . END
Note: For upward compatibility reasons, $Alpha and $AlphNum do not recognize lowercase English letters as alphabetic characters unless a non-null language parameter is specified.