Character-wise translate string(逐字符翻译字符串(Character-wise translate string))¶
Supported in: Batch, Faster, Streaming
Replaces individual characters from the input column that are found in the matching with the corresponding character in the replacement string. If the matching string is longer than the replacement string, characters at the end of the matching string will be dropped.
Expression categories: String
Declared arguments¶
- Expression: Expression to translate.
Expression\ - Matching string: String containing characters that match the input string.
Literal\ - Replacement string: String containing characters to replace matching characters.
Literal\
Output type: String
Examples¶
Example 1: Base case¶
Argument values:
- Expression: translate
- Matching string: rnlt
- Replacement string: 123
Output: 1a2s3ae
Example 2: Base case¶
Argument values:
- Expression: abc
- Matching string: aab
- Replacement string: de
Output: dc
Example 3: Base case¶
Argument values:
- Expression: abc
- Matching string: acb
- Replacement string: de
Output: de
Example 4: Base case¶
Argument values:
- Expression: abc
- Matching string: ac
- Replacement string: df
Output: dbf
Example 5: Null case¶
Argument values:
- Expression: null
- Matching string: a
- Replacement string: b
Output: null
中文翻译¶
逐字符翻译字符串(Character-wise translate string)¶
支持:批处理(Batch)、快速处理(Faster)、流处理(Streaming)
将输入列中与匹配字符串(matching string)匹配的单个字符替换为替换字符串(replacement string)中对应的字符。如果匹配字符串比替换字符串长,则匹配字符串末尾的字符将被丢弃。
表达式类别: 字符串(String)
声明的参数¶
- 表达式(Expression): 要翻译的表达式。
表达式\<任意类型> - 匹配字符串(Matching string): 包含与输入字符串匹配的字符的字符串。
字面量\<字符串> - 替换字符串(Replacement string): 包含用于替换匹配字符的字符的字符串。
字面量\<字符串>
输出类型: 字符串
示例¶
示例 1:基本情况¶
参数值:
- 表达式: translate
- 匹配字符串: rnlt
- 替换字符串: 123
输出: 1a2s3ae
示例 2:基本情况¶
参数值:
- 表达式: abc
- 匹配字符串: aab
- 替换字符串: de
输出: dc
示例 3:基本情况¶
参数值:
- 表达式: abc
- 匹配字符串: acb
- 替换字符串: de
输出: de
示例 4:基本情况¶
参数值:
- 表达式: abc
- 匹配字符串: ac
- 替换字符串: df
输出: dbf
示例 5:空值情况¶
参数值:
- 表达式: null
- 匹配字符串: a
- 替换字符串: b
输出: null