NET/MASTER Network Control Language (NCL) Reference Manual

WORDPOS
Built-in Functions
4–108 106126 Tandem Computers Incorporated
WORDPOS The WORDPOS built-in function returns the first position of a word or a phrase of
words within a specified string. 0 (zero) is returned if the phrase is not found within
the string.
WORDPOS(
phrase
,
string
[,
start
] )
phrase
specifies the substring to be searched for.
string
specifies the string to be searched.
start
specifies a starting position for the search. This optional operand must be a
positive whole number. If omitted, the search starts at the beginning of the
specified string. If
star
t specifies a starting position that is beyond the end of
string
, 0 (zero) is returned.
Considerations
phrase
and
string
need not have the same number of spaces between words.
However, the actual words must be identical.
See also SUBWORD, WORD, and WORDINDEX. The SUBWORD built-in
function extracts a substring from a string starting from a specified word in the
string. The WORD built-in function extracts a word from a string. The
WORDINDEX built-in function returns the position of the first character of a word
in a specified string.
Examples
In the following example, the string “now is the time” is searched for the substring
containing the words “is the”. The starting position for the search is specified as the
second word. This substring starts at the second word in the specified string, so a
value of “2” is returned:
&A = is the
&B = now is the time
&c = 2
&RESULT = WORDPOS(&A,&B,&C)