split

split使用参数作为分隔符将输入字符串分成数组。 split通常用于将逗号分隔的项从字符串转换为数组。

输入

{% assign beatles = "John, Paul, George, Ringo" | split: ", " %}

{% for member in beatles %}
  {{ member }}
{% endfor %}

输出

John
Paul
George
Ringo