split
string | split: string
returns array of string
Splits a string into an array of substrings based on a given separator.
{%- assign title_words = product.handle | split: '-' -%}
{% for word in title_words -%}
{{ word }}
{%- endfor %}
{%- assign title_words = product.handle | split: '-' -%}
{% for word in title_words -%}
{{ word }}
{%- endfor %}
{
"product": {
"handle": "health-potion"
}
}
Output
health
potion
Was this page helpful?