Syntax

	$input.split(separator: ",", trim: true)

Description

Splits an input string into a list of strings using a given separator. All occurrences of the separator string are searched for in the input string and the character strings between the separators are returned as a list.

Parameters

String name Type Type Description Mandatory Default
input Character string The character string to be split Yes
separator String/regular expression The separator to be used to split the input string. no ","
trim Truth value Whether to remove spaces at the beginning and end of the result entries. no true

Return value

Type: List of character strings

The character strings between the separators found in the input string.

Examples

Standard separator

	"a, b, c".split()

Output: ["a", "b", "c"]

The list of comma-separated words from the input.

With separator

	"Hello world and hello moon!".split(" ")

Output: ["Hello", "world", "and", "hello", "moon!"]

The space-separated words from the input.

With regular expression

	"a --- b - c -- d".split(regex("-+"))

Output: ["a", "b", "c", "d"]

The words in the input separated by any number of minus signs.

Without trimming

	"a, b, c".split(trim:false)

Output: ["a", " b", " c"]

Exactly the character strings between the separators. There is a space before each of the characters b and c.