Product SiteDocumentation Site

5.4.15.34. translate


>>-translate-+--------------------------------------------------------------------------+-><
             +-(--+-------------------------------------+-+-----------------------+-)---+
                  +-tableo--+-------------------------+-+ +-,--+---+--+---------+-+
                            +-,--+--------+--+------+-+        +-n-+  +-,length-+
                                 +-tablei-+  +-,pad-+

Returns the receiving buffer with each character translated to another character or unchanged.
The output table is tableo and the input translation table is tablei. translate searches tablei for each character in the receiving buffer. If the character is found, the corresponding character in tableo is replaces the character in the buffer. If there are duplicates in tablei, the first (leftmost) occurrence is used. If the character is not found, the original character in the receiving buffer is unchanged.
The tables can be of any length. If you specify neither translation table and omit pad, the receiving string is translated to uppercase (that is, lowercase a-z to uppercase A-Z), but if you include pad the buffer translates the entire string to pad characters. tablei defaults to XRANGE("00"x,"FF"x), and tableo defaults to the null string and is padded with pad or truncated as necessary. The default pad is a blank.
n is the position of the first character of the translated range. The default starting position is 1. length is the range of characters to be translated. If omitted, length remainder of the buffer from the starting position to the end is used.