split
根据参数传入的分隔符将字符串分解为数组。split
通常被用于将以逗号为分隔符的字符串转换为数组。
输入
{% assign beatles = "John, Paul, George, Ringo" | split: ", " %}
{% for member in beatles %}
{{ member }}
{% endfor %}
输出
John
Paul
George
Ringo
根据参数传入的分隔符将字符串分解为数组。split
通常被用于将以逗号为分隔符的字符串转换为数组。
输入
{% assign beatles = "John, Paul, George, Ringo" | split: ", " %}
{% for member in beatles %}
{{ member }}
{% endfor %}
输出
John
Paul
George
Ringo