$Alpha: Difference between revisions
m (add italics) |
m (typo) |
||
Line 13: | Line 13: | ||
<li>0, for a false condition if one of these occurs: | <li>0, for a false condition if one of these occurs: | ||
<ul> | <ul> | ||
<li><var class="term">string</var> contains digits, spaces, or punctuation marks | <li><var class="term">string</var> contains digits, spaces, or punctuation marks</li> | ||
<li><var class="term">string</var> is null</li> | <li><var class="term">string</var> is null</li> | ||
<li>U.S. English characters in the string have accent marks | <li>U.S. English characters in the string have accent marks</li> | ||
</ul></li> | </ul></li> | ||
</ul></td></tr> | </ul></td></tr> | ||
Line 23: | Line 23: | ||
<ul> | <ul> | ||
<li>A literal enclosed in quotation marks</li> | <li>A literal enclosed in quotation marks</li> | ||
<li>A [[ | <li>A [[Using variables and values in_computation|%variable]]</li> | ||
<li>A field name without quotation marks. In this case, the function call must be embedded in a <var>[[Record_loops#FOR_EACH_RECORD_statement|FOR EACH RECORD]]</var> loop where the current value of the field is verified.</li> | <li>A field name without quotation marks. In this case, the function call must be embedded in a <var>[[Record_loops#FOR_EACH_RECORD_statement|FOR EACH RECORD]]</var> loop where the current value of the field is verified.</li> | ||
</ul></td></tr> | </ul></td></tr> |
Latest revision as of 20:04, 8 January 2018
The $Alpha function verifies whether a string is composed only of characters that are valid in the specified (or default) language.
Syntax
%result = $Alpha(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 table has examples of the string and language arguments as literals.
Function code... | Returns... |
---|---|
$alpha('JOHN','US') |
1 |
$alpha('MÂCON','FRENCHC') |
1 |
$alpha('MÂCON','US') |
0 |
$alpha('JOHN SMITH','US') |
0 |
$alpha('ÎLE D'ORLÉANS','FRENCHC') |
0 |
$alpha('12A','US') |
0 |
$alpha('12A','FRENCHC') |
0 |
In the following code example, the request sorts and prints the names of agents whose name contains nonalphabetic characters. The quoted asterisk in the $Alpha call causes Model 204 to verify the contents of the field AGENT
against whatever language is indicated by the value of the LANGUSER parameter:
RESET LANGUSER 'FRENCHC' BEGIN POL.HOLDERS: FIND ALL RECORDS FOR WHICH RECTYPE = POLICYHOLDER END FIND FOR EACH RECORD IN POL.HOLDERS IF NOT $alpha (AGENT, '*') THEN PLACE RECORD ON LIST BADNAME END IF END FOR ORDERED.LIST: SORT RECORDS ON LIST BADNAME BY AGENT FOR EACH RECORD IN ORDERED.LIST PRINT AGENT END FOR 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.