Edit

Share via


TRANSLATE ER function

Note

Community interest groups have now moved from Yammer to Microsoft Viva Engage. To join a Viva Engage community and take part in the latest discussions, fill out the Request access to Finance and Operations Viva Engage Community form and choose the community you want to join.

The TRANSLATE function returns a String value that contains the result of the character replacement of specified text in characters of another provided set.

Syntax

TRANSLATE (text , pattern, replacement)

Arguments

text: String

The valid path of a data source of the String type.

pattern: String

The text that you want to replace.

replacement: String

The text to use as a replacement.

Return values

String

The resulting text value.

Usage notes

The TRANSLATE function replaces one character at a time. The function replaces the first character of the text argument with the first character of the pattern argument and then the second character and follows the same flow until finished. When a character from the text and pattern arguments match, the function replaces it with a character from the replacement argument that is in the same position as the character from the pattern argument. If a character appears multiple times in the pattern argument, the function uses the replacement argument mapping that corresponds to the first occurrence of this character.

Example 1

TRANSLATE ("abcdef", "cd", "GH") replaces the "c" character of the specified “abcdef” text with the "G" character of the replacement text due to the following reasons:

  • The "c" character is presented in the pattern text in the first position.
  • The first position of the replacement text contains the "G" character.

Example 2

TRANSLATE ("abcdef", "ccd", "GH") returns "abGdef".

Example 3

TRANSLATE ("abccba", "abc", "123") returns "123321".

Additional resources

Text functions