4D v14

TRANSLATE

Home

 
4D v14
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'

 
PROPERTIES 

Product: 4D
Theme: Functions

 
SEE ALSO 

REPLACE

 
ARTICLE USAGE

4D SQL Reference ( 4D v11 SQL Release 4 )
4D SQL Reference ( 4D v14)
4D SQL Reference ( 4D v12.1)
4D SQL Reference ( 4D v13.4)
4D SQL Reference ( 4D v14 R2)
4D SQL Reference ( 4D v14 R3)
4D SQL Reference ( 4D v14 R4)