Skip to content

Split ​

Splits a string into an array of substrings at each instance of a separator. An empty separator splits the string into single characters.

liquid
{{ string | split: separator }}

Example ​

liquid
{% assign colors = 'red,green,blue' | split: ',' %}
{% for color in colors %}
  {{- color }}
{% endfor %}

Output

html
red
green
blue