split
Cuts text into a list at every separator.
Details #
split(text, separator) takes exactly two arguments and returns a list of text. The separator is plain text, not a regular expression.
split("a,b,c", ",")is["a","b","c"].An empty separator splits into single characters.
When the separator isn't found the list has one item, the whole text. Empty text gives a list with one empty item.
Items are not trimmed.
Parameters #
Takes 2 arguments.
{{ split(text, b) }}
Examples #
split("a,b,c", ",")→
[
"a",
"b",
"c"
]split(csv, ",")[1]→
y| Sample variable | Value |
|---|---|
csv | x,y,z |
split(text, "\n").length→
3| Sample variable | Value |
|---|---|
text | one
two
three |
See also #
Use join to go back from a list to text.