TRANSLATE

4D - Documentation   Français   English   German   Japanese   4D SQL Reference, Table of Contents   4D SQL Reference, Index   Back   Previous   Next

version 11


TRANSLATE (arithmetic_expression, arithmetic_expression, arithmetic_expression)

Description

The TRANSLATE function returns the first arithmetic_expression with all occurrences of each of the characters passed in the second arithmetic_expression replaced by their corresponding characters passed in the third arithmetic_expression.

This replacement is carried out on a character by character basis (e.g. 1st character of the second arithmetic_expression is replaced each time it occurs in the first arithmetic_expression by the 1st character of the third arithmetic_expression, and so on).

If there are fewer characters in the third arithmetic_expression than in the second one, any occurrences of characters found in the second arithmetic_expression that do not have a corresponding character in the third arithmetic_expression will be removed from the first arithmetic_expression (e.g. if the second arithmetic_expression has five characters to be searched for and the third arithmetic_expression only contains four replacement characters, each time the fifth character of the second arithmetic_expression is found in the first arithmetic_expression, it will be removed from the value returned).

Example

This example replaces all occurrences of "a" with "1" and all occurrences of "b" with "2":

   TRANSLATE ('abcd', 'ab', '12') 
      ` returns '12cd'

See Also

REPLACE.


4D - Documentation   Français   English   German   Japanese   4D SQL Reference, Table of Contents   4D SQL Reference, Index   Back   Previous   Next