3.2.56. TRANSLATE(string[,[tablein][,[tableout][,padchar]]])

Performs a translation on the characters in string. As a special
case, if neither tablein nor tableout is specified, it will
translate string from lower case to upper case. Note that this
operation may depend on the language chosen, if your interpreter
supports national character sets.

Two translation tables might be specified as the strings tablein
and tableout.  If one or both of the tables are specified, each
character in string that exists in tablein is translated to the
character in tableout that occupies the same position as the
character did in tablein. The tablein defaults to the whole
character set (all 256) in numeric sequence, while tableout
defaults to an empty set. Characters not in tablein are left
unchanged.

If tableout is larger than tablein, the extra entries are ignored.
If it is smaller than tablein it is padded with padchar to the
correct length. Padchar defaults to <space>.

If a character occurs more than once in tablein, only the first
occurrence will matter.

TRANSLATE(‘FooBar’)                     –>   ‘FOOBAR’
TRANSLATE(‘FooBar’, ‘ABFORabfor’, ‘abforABFOR’)   –>   ‘fOObAR’
TRANSLATE(‘FooBar’, ‘abfor’)                 –>   ‘F  B  ’
TRANSLATE(‘FooBar, ‘abfor’,, ‘#’)            –>   ‘F##B##’



PREV NEXT