NET/MASTER Network Control Language (NCL) Reference Manual

ABBREV
Built-in Functions
4–6 106126 Tandem Computers Incorporated
ABBREV The ABBREV built-in function tests a string for a valid abbreviation by comparing its
leading characters to an abbreviation in another string. If the strings match, it is a true
condition, and 1 is returned. A false match returns a value of 0 (zero). The case of
both strings must match; that is, both must be either lowercase or uppercase.
ABBREV(
string
,
abbreviation
[,
length
] )
string
specifies the string that is to be tested.
abbreviation
specifies the abbreviation to be compared with the leading characters of the string.
A null string supplied for
abbreviation
always results in a match if a length of
0 (zero) is used.
length
specifies the number of characters in
abbreviation
to be compared with the
string. If
abbreviation
is shorter than this length, 0 (zero) is returned,
regardless of whether
abbreviation
matches
string
. The length of
abbreviation
can be longer than the value of
length
. If the strings match for
the specified length, 1 is returned.
If
length
is omitted, the length of
abbreviation
is used.
Consideration
See also COMPARE, which compares two strings and returns the position of the first
differing character.
Examples
In the following example, the string “PRI” is a valid abbreviation of the string
“PRINT”. NCL returns a value of 1:
&RESULT = ABBREV(PRINT,PRI)
In the following example, the string “Pri” is not a valid abbreviation of the string
“PRINT”. NCL returns a value of 0 (zero):
SAY ABBREV(PRINT,Pri)
In the following example, the length of the strings to be compared has been specified
as 4 but the supplied abbreviation is only three characters in length. NCL returns a
value of 0 (zero):
SAY ABBREV(PRINT,PRI,4)