Skip to content

String Split

Splits a string into a list of substrings by a delimiter.

This node splits an input string into a list of substrings based on a given delimiter.

Max Segments#

The max_segments input controls the number of substrings returned:

Value Behavior
> 0 At most N substrings; the last substring is the unsplit remainder.
0 Returns an empty list.
< 0 Returns all substrings. This is the default behavior (-1).

Delimiter Special Characters#

The delimiter input automatically converts the following escaped characters into their actual representations:

  • \n (newline)
  • \t (tab)
  • \r (carriage return)

For example, to split a multi-line string into individual lines, use \n as the delimiter.

Inputs#

Port Description
String
The string to split.
Delimiter
The separator to split the string by.
Max segments
Maximum number of substrings to return. -1 means no limit.

Outputs#

Port Description
Segments
The list of substrings.

ID: core/string-split@v1