split-text

Create a list from text

Splits a text into a list of texts using a specified separator text to determine where to make each split.

Arguments

Inputs:

text: The text to be split.

separator: The separator text, or regular expression, which denotes the points at which each split should occur. The separator is treated a regular expression if it begins and ends with /. If unspecified, defaults to (newline).

limit: A positive integer specifying a limit on the number of splits to be found. If unspecified, defaults to null (no limit).

Output:

subtexts: A list of texts split at each point where the separator occurs in the input text, or an empty list if no occurrences are found.

occurrences: The number of times the separator occurs in the input text.

Last updated