OS/2 Procedures Language 2/REXX


Inf-HTML [About][Toc][Index] 0.9b (c) 1995 Peter Childs


TRANSLATE




 >>--TRANSLATE(string -+----------------------------------+-)--><
                       +-,-+--------+-+------------------++
                           +-tableo-+ +-,-+------+-+----++
                                          +tablei+ +,pad+

TRANSLATE translates characters in string to other characters, or reorders 
characters in a string. If neither translate table is given, string is 
simply translated to uppercase (for example, a lowercase a-z to an 
uppercase A-Z). The output table is tableo and the input translate table 
is tablei (the default is XRANGE('00'x,'FF'x)). The output table defaults 
to the null string and is padded with pad or truncated as necessary. The 
default pad is a blank. The tables can be of any length; the first 
occurrence of a character in the input table is the one that is used if 
there are duplicates. 
Here are some examples: 

TRANSLATE('abcdef')                        ->    'ABCDEF'
TRANSLATE('abbc','&','b')                  ->    'a&&c'
TRANSLATE('abcdef','12','ec')              ->    'ab2d1f'
TRANSLATE('abcdef','12','abcd','.')        ->    '12..ef'
TRANSLATE('4123','abcd','1234')            ->    'dabc'

Note:    The last example shows how to use the TRANSLATE function to 
         reorder the characters in a string.  In the example, the last 
         character of any four-character string specified as the second 
         argument would be moved to the beginning of the string. 
   

Inf-HTML End Run - Successful