split

Splits the input string into an array of substrings.

split

Splits the input string into an array of substrings.

Type: transform

Parameters

  • input (unknown): The input string to split.
  • separator (string): The separator string to split on.

Returns

Type: array

An array of substrings, or empty array if input is not a string.

Examples

split("foo,bar,baz", ",") // ["foo", "bar", "baz"]
"one-two-three"|split("-") // ["one", "two", "three"]
split("hello world", " ") // ["hello", "world"]
Cookie Notice

We use cookies to enhance your browsing experience.