snowflake.snowpark.functions.translate(src: Union[Column, str], source_alphabet: Union[Column, str], target_alphabet: Union[Column, str]) Column[source]

Translates src from the characters in source_alphabet to the characters in target_alphabet. Each character matching a character at position i in the source_alphabet is replaced with the character at position i in the target_alphabet. If target_alphabet is shorter, and there is no corresponding character the character is omitted. target_alphabet can not be longer than source_alphabet.


>>> df = session.create_dataframe(["abcdef", "abba"], schema=["a"])
>>>"a"), lit("abc"), lit("ABC")).as_("ans")).collect()
[Row(ANS='ABCdef'), Row(ANS='ABBA')]

>>> df = session.create_dataframe(["file with spaces.txt", "\ttest"], schema=["a"])
>>>"a"), lit(" \t"), lit("_")).as_("ans")).collect()
[Row(ANS='file_with_spaces.txt'), Row(ANS='test')]