You have been redirected from an outdated version of the article. Below is the content available on this topic. To view the old article click here.

split()

Usage

split(string, separator)

Description
Uses the given separator to split the given string into a collection of strings. This is the opposite of join().

New from 2.0.2:

The default separator is a regular expression which splits the string at any of the following characters:

, ; <whitespace>

The optional second parameter is used as literal separator, it is NOT used as a regex. To use a regular expression to split a string, see split_regex().

Examples

Any of these expressions

${split('one,two,three')}
${split('one;two;three')}
${split('one two three')}
${split('one::two::three', '::')}
${split('one.two.three', '.')}

results in

[one, two, three]

Search results for "split()"

split()

Uses the given separator to split the given string into a collection of strings. This is the opposite of join().

The default separator is a regular expression which splits the string at ANY of the following characters: ,;(whitespace)
The optional second parameter is used as literal separator, it is NOT used as a regex. To use a regular expression to split a string, see split_regex().

split(string [, separator])