TEXTSPLIT function

TEXTSPLIT(text, delimiter, limit?) TEXTSPLIT(text; delimiter; limit?)

text — Text

The text string which should be split apart.

delimiter — Text

The delimiter.

limit — Number (optional)

The maximum number of returned array elements. If omitted, there is no limit.

Returns — { Text }

The parts of the text string that has been split apart.

Divides a text string into parts using a delimiter, returning the parts as an array. TEXTSPLIT("first, second, third", ", ")TEXTSPLIT("first, second, third"; ", ") returns the array { "first", "second", "third" }{ "first"; "second"; "third" }. The delimiter ", " is used to separate the returned parts.

REGEXSPLIT also breaks text apart, but uses regular expressions. As a result, REGEXSPLIT is much more powerful than TEXTSPLIT, but can be harder to understand. Unlike a delimiter consisting of a plain text string, a regular expression can match an arbitrary number of characters. For instance, REGEXSPLIT can successfully break apart the string "first ,second ; third" into the array { "first", "second", "third" }{ "first"; "second"; "third" }. Use REGEXSPLIT to break apart more complex text strings.

Examples

TEXTSPLIT("first, second, third", ", ")TEXTSPLIT("first, second, third"; ", ")

Returns the array { "first", "second", "third" }{ "first"; "second"; "third" }.

TEXTSPLIT(TextFieldWithMultipleLines, NEWLINE())TEXTSPLIT(TextFieldWithMultipleLines; NEWLINE())

Returns the text of the TextFieldWithMultipleLines text field, split into its constituent lines, in the form of an array. If "abc" has been entered on the first line and "def" has been entered on the second line, the array { "abc", "def" }{ "abc"; "def" } is returned.

REGEXSPLIT("first ,second ; third", "[\s\t;,]+")REGEXSPLIT("first ,second ; third"; "[\s\t;,]+")

Returns the array { "first", "second", "third" }{ "first"; "second"; "third" }. REGEXSPLIT also breaks text apart, but uses a regular expression as a delimiter. As a result, REGEXSPLIT is more powerful, but can be harder to understand.