split()

Search
Feedback

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]

Graph-Browser

Related Articles
About this article
Last change 2016-06-30
Topics FrontendFunctionsStructr 2.0