Is there a way to sort an array of numbers in liquid

Viewed 42

I am trying to sort an array of number in liquid I have try like the following example:

{% assign numbers = "248 (3), 32 (7), 415 (5), " | split: ", " %}
{% assign sortedNumbers = numbers | sort %}

{% for numb in sortedNumbers -%}
  {{ numb }}
{%- endfor %}

The output of this is: 248 (3) 32 (7) 415 (5)

but expected: 32 (7) 248 (3) 415 (5)

do you know how I could sort the array in the expected way?

0 Answers
Related