Skip to content

Split

mapping category: string no `||` new-mode: required resultSize: 1

Splits a STRING into an ARRAY of pieces on a delimiter.

Split(delimiter) divides the input STRING into pieces wherever the (possibly multi-character) delimiter occurs, producing an ARRAY of STRING values. Splitting follows the usual explicit-separator semantics: adjacent delimiters and leading/trailing delimiters yield empty pieces, and a delimiter that does not occur yields a single-element ARRAY containing the whole input.

Typically used to fan a compound source value into its parts for further processing — for example a "low-high" reference range into its two bounds, or a space-separated code into tokens — then chained into | Rule() (per-element), At(n), Size(), or a LoopOver expansion.

Split returns the whole ARRAY itself, so it does not take the [] suffix — write :value => Split("-"), the same way as Remove and Without. (The [] suffix is for scalar-per-result collectors such as UsagiMap()[] or Use(...)[N]; using it here would also drop the STRING element-type hint that a following | Rule() needs.)

Available in new mode only.

Parameters

1delimiter Mandatory — accepts: STRING

The separator to split on. Must be a non-empty string literal; field references and ARRAY literals are not accepted.

Input type

  • STRING

Output type

  • ARRAY

Requires

  • Exactly one STRING-typed pipeline input.

Examples

Split a reference range into its two bounds, parsing each

:range => Split("-") | AsFloat()

Tokenise a space-separated value

:blood_group => Split(" ")

Split then take the first piece

:code => Split(".") => At(0)

Errors

  • `Split' expects varchar but got'`
    The pipeline value reaching the rule is not a STRING.
  • `Split' requires exactly one non-empty string delimiter
    Wrong arity, an empty delimiter, an ARRAY literal, or a field reference.
  • `Split' is only available in new mode
    New mode is not enabled in etl.conf.

See also

SubString, Regex, Remove, At, Size