NET/MASTER Network Control Language (NCL) Reference Manual
DELWORD
Built-in Functions
106126 Tandem Computers Incorporated 4–41
DELWORD The DELWORD built-in function deletes a specified number of words from a string,
starting at a specified word. In this context, a word consists of one or more characters
separated by spaces. Care must be taken if the word contains any special characters
such as arithmetic or Boolean operators. In this case, the string must be enclosed in
quotes for this built-in function to work correctly. See the second example following.
DELWORD(
string
,
n
[,
length
] )
string
specifies the string.
n
specifies the word position at which the deletion starts. If
n
specifies a word
position beyond the end of the string, nothing is deleted.
n
must be a positive
whole number.
length
specifies an optional number of words to delete. If
length
is omitted, the rest of
the string, from the specified word position
n
, is deleted.
length
must be a
positive whole number.
Considerations
Any spaces after the last word deleted are removed.
See also DELSTR, which deletes part of a string as specified by operands that
define where to start and how much to delete.
Examples
In the following example, the delete begins at word 2 (is) and continues for two words
(is the). The two spaces after the word “the” are also deleted. The output string is
“Now time”:
&A = Now is the time
&B = 2
&C = 2
&RESULT = DELWORD(&A,&B,&C)
In the following example, the delete begins at word 3 (the) and continues to the end of
the string because no length is specified. The output string is “Now +”. Without the
quotes surrounding the string, a compilation error results because NCL treats the plus
sign as an arithmetic operator:
SAY DELWORD(“Now + the time”,3)