translate

www.altova.com Print this Topic Previous Page Up One Level Next page

Home >  Functions > Function Library Reference > core | string functions >

translate

The characters of string1 (search string) are replaced by the characters at the same position in string2 (replace string), in the input string "value".

fn-translate

When there are no corresponding characters in string2, the character is removed.

fn-transl-eg

E.g.

input string is 123145

 (search) string1 is 15

 (replace) string2 is xy

 

So:

each 1 is replaced by x in the input string value

each 5 is replaced by y in the input sting value

 

Result string is x23x4y

 

 

If string2 is empty (fewer characters than string1) then the character is removed.

 

E.g.2

input string aabaacbca

 string1 is "a"

 string2 is ""        (empty string)

 

result string is "bcbc"

 

E.g.3

input string aabaacbca

 string1 is "ac"

 string2 is "ca"

 

result string is "ccbccabac"


© 2019 Altova GmbH