NET/MASTER Network Control Language (NCL) Reference Manual
SPACE
Built-in Functions
106126 Tandem Computers Incorporated 4–75
SPACE The SPACE built-in function removes extraneous spaces from a string and optionally
replaces them with another character.
SPACE(
string
[, [
n
] [,
pad
] ] )
string
specifies the string to be reformatted. Leading and trailing spaces are always
removed.
n
specifies the number of pad characters to be placed between words.
n
must be a
nonnegative whole number. If 0 (zero) is specified, all spaces are removed; they
are not replaced by the pad character.
pad
specifies the character to be used to pad the string. The character, if omitted,
defaults to a space character.
Considerations
A null input string results in a null output string.
If
n
and
pad
are omitted, multiple spaces between words are normalized to a
single space.
See also JUSTIFY and STRIP. The JUSTIFY built-in function inserts spaces or
user-specified pad characters into a string. The STRIP built-in function strips a
specified leading and/or trailing character, or characters, from a string.
Examples
In the following example, the string “ abc xxx ” has the leading and trailing spaces
removed. Because the
n
and
pad
operands have not been specified, the two spaces
between “abc” and “xxx” are normalized to one space. The output string is “abc xxx”:
SAY SPACE( abc xxx )
In the following example, leading and trailing spaces in the string “ abc def g ” are
removed. The spaces between the letters are replaced by two pound sign (#)
characters. The output string is “abc##def##g”:
&A = " ABC DEF G "
&B = 2
&C = #
&RESULT = SPACE(&A,&B,&C)