Ad

Liquid Syntax Remove Apostrophe

- 1 answer

We are trying to solve this issue with an apostrophe in liquid syntax.

We've this value - 'products':'bags' in the variable and we would like to split it and remove the apostrophe.

{% assign values = field | remove: "'" | split: ":" %}

But this is not working.

Any help would be appreciated.

Ad

Answer

This looks ok to me. When I do

{% assign values = "'products':'bags' " | remove: "'" | split: ":" %}
{% for word in values %}
{{ word }}
{% endfor %}

I get

products

bags 

What did you want to be different?

Ad
source: stackoverflow.com
Ad