This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
||||||||||||||
|
4D v20 R8
TRANSLATE
|
|
||
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).
This example replaces all occurrences of "a" with "1" and all occurrences of "b" with "2":
TRANSLATE ('abcd', 'ab', '12')
` returns '12cd'
Product: 4D
Theme: Functions
4D SQL Reference ( 4D v20 R8)