NET/MASTER Network Control Language (NCL) Reference Manual

TRANSLATE
Built-in Functions
106126 Tandem Computers Incorporated 4–87
See also UPPER and LOWER. The UPPER built-in function converts a string to
uppercase characters in the native (ASCII) character set; the LOWER built-in
function converts a specified string to lowercase characters in the native (ASCII)
character set.
Examples
Because no tables are specified in this example, the lowercase string “abcdef” is
converted (translated) to uppercase characters. The output string is “ABCDEF”:
SAY TRANSLATE(abcdef)
In the following example, the string “xyzzy” is translated using the output table “*”
and the input table “z”. All occurrences of “z” in the given string are mapped to “*”.
The output string is “xy**y”:
&A = xyzzy
&B = "*"
&C = z
&RESULT = TRANSLATE(&A,&B,&C)
In the following example, the string “2314” is translated using the output table “abcd”
and the input table “1234”. The output string is “bcad”:
SAY TRANSLATE("2314","abcd","1234")
In the previous example, the first character of the given input string is a 2. This
character is located in the input table “1234”. Its position in this table is used as an
index to the output table. The index in this case is also a 2. The index 2 points to the
character “b” in the output table, and this becomes the first character of the resulting
output string. The next character of the given string is treated in the same manner,
and “c” is the result. The same is true for the remaining characters in the input string,
which are “1” and “4”.
In the following example, the string “2314” is translated using the pad character “#” as
a pseudo-output table because a true output table is not specified. The length of this
pseudo-output table is defined to be the same length as the specified input table
“1234”. The result is the output string “####”:
SAY TRANSLATE("2314",,"1234","#")