Please enable JavaScript to view this site.

R:BASE 11 Help

Navigation: Function Index > T

TRANSLATE

Scroll Prev Top Next More

(TRANSLATE('inputstring','characters','translations','pad'))

 

Returns the string provided as a first argument after some characters specified in the second argument are translated into a destination set of characters. In the process, TRANSLATE replaces a single character at a time. For example, it will replace the 1st character in the "input string" with the 1st character in the "replacement string". Then, it will replace the 2nd character in the "input string" with the 2nd character in the "replacement string", and so forth. The pad parameter is optional which can be used instead of a blank in the return string.

 

In the following example the square and curly braces in the input string are replaced with parentheses, resulting with "2*(3+4)/(7-2)".

 

SET VAR vBracketSwitch = (TRANSLATE('2*[3+4]/{7-2}','[]{}','()()'))

 

In the following example the "w" and "t" replace the "8" and "7" corresponding number values in the string. The "9" and "0" are replaced with the pad character, resulting in "123456tw..".

 

SET VAR vNumberText = (TRANSLATE('1234567890','8790','wt','.'))