Split string(拆分字符串(Split string))¶
Supported in: Batch, Faster, Streaming
Split string on specified regex pattern.
Expression categories: String
Declared arguments¶
- Expression: Input string to split on the specified pattern.
Expression\ - Pattern: The regex pattern to split on.
Regex - optional Limit: Split the string into at most this number of elements. Must be greater than 0.
Literal\
Output type: Array\
Examples¶
Example 1: Base case¶
Argument values:
- Expression:
string - Pattern:
- Limit: 2
| string | Output |
|---|---|
| hello | [ hello ] |
| hello world | [ hello, world ] |
| hello there world | [ hello, there world ] |
Example 2: Base case¶
Argument values:
- Expression: oneAtwoBthreeC
- Pattern: [ABC]
- Limit: 10
Output: [ one, two, three, empty string ]
Example 3: Base case¶
Argument values:
- Expression: oneAtwoBthreeC
- Pattern: [ABC]
- Limit: 2
Output: [ one, twoBthreeC ]
Example 4: Null case¶
Argument values:
- Expression: null
- Pattern: pattern
- Limit: null
Output: null
Example 5: Edge case¶
Argument values:
- Expression: empty string
- Pattern: foo
- Limit: null
Output: [ empty string ]
Example 6: Edge case¶
Argument values:
- Expression: abc
- Pattern: empty string
- Limit: null
Output: [ a, b, c ]
Example 7: Edge case¶
Argument values:
- Expression: empty string
- Pattern: empty string
- Limit: null
Output: [ empty string ]
中文翻译¶
拆分字符串(Split string)¶
支持:批处理(Batch)、快速处理(Faster)、流处理(Streaming)
根据指定的正则表达式(regex)模式拆分字符串。
表达式类别: 字符串(String)
声明的参数¶
- 表达式(Expression): 要按指定模式拆分的输入字符串。
Expression\ - 模式(Pattern): 用于拆分的正则表达式模式。
Regex - 可选 限制(Limit): 将字符串拆分为最多此数量的元素。必须大于0。
Literal\
输出类型: Array\
示例¶
示例1:基础情况¶
参数值:
- 表达式:
string - 模式:
- 限制: 2
| string | 输出 |
|---|---|
| hello | [ hello ] |
| hello world | [ hello, world ] |
| hello there world | [ hello, there world ] |
示例2:基础情况¶
参数值:
- 表达式: oneAtwoBthreeC
- 模式: [ABC]
- 限制: 10
输出: [ one, two, three, 空字符串 ]
示例3:基础情况¶
参数值:
- 表达式: oneAtwoBthreeC
- 模式: [ABC]
- 限制: 2
输出: [ one, twoBthreeC ]
示例4:空值情况¶
参数值:
- 表达式: null
- 模式: pattern
- 限制: null
输出: null
示例5:边界情况¶
参数值:
- 表达式: 空字符串
- 模式: foo
- 限制: null
输出: [ 空字符串 ]
示例6:边界情况¶
参数值:
- 表达式: abc
- 模式: 空字符串
- 限制: null
输出: [ a, b, c ]
示例7:边界情况¶
参数值:
- 表达式: 空字符串
- 模式: 空字符串
- 限制: null
输出: [ 空字符串 ]