mirror of
https://github.com/kemko/liquid.git
synced 2026-01-02 08:15:41 +03:00
721 B
721 B
title
| title |
|---|
| reverse |
Reverses the order of the items in an array. reverse cannot reverse a string.
{% raw %}
{% assign my_array = "apples, oranges, peaches, plums" | split: ", " %}
{{ my_array | reverse | join: ", " }}
{% endraw %}
{% assign my_array = "apples, oranges, peaches, plums" | split: ", " %}
{{ my_array | reverse | join: ", " }}
reverse cannot be used directly on a string, but you can split a string into an array, reverse the array, and rejoin it by chaining together filters:
{% raw %}
{{ "Ground control to Major Tom." | split: "" | reverse | join: "" }}
{% endraw %}
{{ "Ground control to Major Tom." | split: "" | reverse | join: "" }}