4D v16

TRANSLATE

Home

 
4D v16
TRANSLATE

TRANSLATE  


 

 

Command TRANSLAT<span style="font-weight: bold;"> </span>TRANSLATE (arithmetic_expression, arithmetic_expression, arithmetic_expression)

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

 
PROPERTIES 

Product: 4D
Theme: Functions

 
HISTORY 

 
ARTICLE USAGE

4D SQL Reference ( 4D v16)