跳转至

Left of string(字符串左侧截取(Left of string))

Supported in: Batch, Faster, Streaming

Extract left hand side of a string based on index.

Expression categories: String

Declared arguments

  • Expression: String input expression.
    Expression\
  • Length: The number of characters to take from the left of the string.
    Expression\

Output type: String

Examples

Example 1: Base case

Argument values:

  • Expression: Hello world!
  • Length: 5

Output: Hello


Example 2: Null case

Argument values:

  • Expression: string
  • Length: length
string length Output
Hello world! -10 empty string

Example 3: Null case

Argument values:

  • Expression: string
  • Length: length
string length Output
null 1 null
Hello world! null null
null null null

Example 4: Edge case

Description: Length greater than the string length will return the full string.

Argument values:

  • Expression: Hello world!
  • Length: 15

Output: Hello world!



中文翻译

字符串左侧截取(Left of string)

支持:批处理(Batch)、快速处理(Faster)、流处理(Streaming)

根据索引提取字符串的左侧部分。

表达式类别: 字符串(String)

声明的参数

  • 表达式(Expression): 字符串输入表达式。
    表达式\<String>
  • 长度(Length): 从字符串左侧截取的字符数量。
    表达式\<Integer>

输出类型: String

示例

示例1:基础情况

参数值:

  • 表达式(Expression): Hello world!
  • 长度(Length): 5

输出: Hello


示例2:空值情况

参数值:

  • 表达式(Expression): string
  • 长度(Length): length
string length 输出(Output)
Hello world! -10 空字符串

示例3:空值情况

参数值:

  • 表达式(Expression): string
  • 长度(Length): length
string length 输出(Output)
null 1 null
Hello world! null null
null null null

示例4:边界情况

描述: 当长度大于字符串长度时,将返回完整字符串。

参数值:

  • 表达式(Expression): Hello world!
  • 长度(Length): 15

输出: Hello world!