PS TEXT FORMAT Reference Manual
Expressions
11387 Tandem Computers Incorporated 5-27
If you enter the same value for the starting and ending character
specifications, it means you want a substring of just one character. For
example:
STRING(sys_chars,4,4)
returns the string “#” (the fourth character in the string making up the
SYS_CHARS variable). If you enter beginning-character and ending-
character specifications that designate positions within the main string, it
means you want a substring that starts and ends with the characters in
those positions. For example:
STRING(58008918,2,6)
returns the string “80089” .
You can use noninteger values for the starting or ending character
specifications, but TFORM truncates them to integers. The STRING
function sees 2.7 as meaning the second character.
TRANSLATE Function The TRANSLATE function returns a string.
TRANSLATE (
s-exp1
,
s-exp2
,
s-exp3
)
The string returned is translated from the first argument which is the
“source” string. The second argument is a “key” string, and the third is a
“replacement” string.
The TRANSLATE function starts with the first character in the key string
and scans the source string, looking for that character. In the output string,
the TRANSLATE function changes all occurrences of that character to the
first character of the replacement string. It then replaces all occurrences in
the source string of the second key character with the second replacement
character, and so on until it reaches the end of the key string.