NET/MASTER Network Control Language (NCL) Reference Manual
RIGHT
Built-in Functions
4–72 106126 Tandem Computers Incorporated
RIGHT The RIGHT built-in function returns the rightmost characters of a string.
RIGHT(
string
,
length
[,
pad
] )
string
specifies the source string.
length
specifies the number of characters to be returned. This operand must always be a
nonnegative whole number. If
length
is greater than the length of the specified
string, the string is padded on the left to the required length.
pad
specifies the pad character to be used. The default is a space.
Consideration
See also LEFT and SUBSTR. The LEFT built-in function returns the leftmost characters
of a string. The SUBSTR built-in function extracts a substring from a string.
Examples
In the following example, the three characters of the string “abc” are preceded by
seven pad characters (defaulted to spaces). The output string is “ abc”:
&A = abc
&B = 10
&RESULT = RIGHT(&A,&B)
In the following example, two characters from the right end of the string “abc0000” are
returned. The output string is “00”. The pad character is ignored:
SAY RIGHT(abc0000,2,#)
In the following example, the required output string length is longer than the original
specified string, so the pad character (specified as the asterisk), pads the output string
to the left by three characters. The asterisk must be contained within quotes because
otherwise NCL treats it as an arithmetic operator:
SAY RIGHT(abc0000,10,"*")
The output string is “***abc0000”.