RAD function: translate

A RAD function that translates from one character set to another.

Programming considerations: This function has been deprecated and is maintained for backward compatibility only. This function can only be used on simple single byte character strings and is not UTF-8 safe. Case conversion on strings should be done with the toupper() and tolower() functions, which are UTF-8 safe.

Function

translate

Format

translate(source, old character set, new character set)

Parameters

The following parameters are valid for the translate function:

Parameter Data type Description
source String The string to translate.
old character set String The existing character set.
new character set String The character set to translate to.

Factors

  • Old and new character sets must be strings of the same length.
  • Old and new character sets may be literals, variables, or fields.
  • A one–for–one correlation must exist between the old and new character sets. For example, the third character in the new set replaces the third character in the old set.

Example

translate("123abcdef","abc","ABC")

After execution, the value is 123ABCdef.