NET/MASTER Network Control Language (NCL) Reference Manual
CENTER
Built-in Functions
106126 Tandem Computers Incorporated 4–29
CENTER The CENTER built-in function centers text within a string. The output string is
padded or truncated at either end to meet the requirements of a length operand.
Note This built-in function may be spelled CENTRE.
CENTER(
string
,
length
[,
pad
] )
string
specifies the text string to be centered.
length
specifies the length of the resulting string.
pad
specifies the character to be used to pad the resulting string. The default pad
character is a space. Any single character may be used as the pad character.
Considerations
If an odd number of characters must be added or truncated, they are added to or
truncated from the right end of the string. See the first example.
See also LEFT, RIGHT and SUBSTR. The LEFT built-in function returns just the
leftmost portion of a string. The RIGHT built-in function returns just the
rightmost portion of a string. The SUBSTR built-in function extracts a portion of a
string.
Examples
In the following example, the string “abc” forms the center of a string of eight
characters, using a pound sign (#) as the pad character. The output string is
“##abc###”:
&A = abc /* the input string */
&B = 8 /* the length */
&C = # /* the pad character */
&RESULT = CENTER(&A,&B,&C)
In the following example, the string “The Blue Sky” forms the center of a string of
eight characters. Because there are more characters in the string than in the specified
length, the string is truncated to “e Blue S”:
SAY CENTER(The Blue Sky,8)