reverse - Liquid Filter Reference - 0.11.4

Filter Name reverse
Group Arrays
Version 0.11.4

Description

Reverses the order of the items in an array. reverse cannot reverse a string.

Examples

{% assign an_array = "earth, water, air, fire" | split: ", " %}

{{ an_array | reverse | join: ", " }}
fire, air, water, earth
Although reverse cannot be used directly on a string, you can split a string into an array, reverse the array, and rejoin it by chaining together filters:
{{ "Mary had a little lamb." | split: "" | reverse | join: "" }}
.bmal elttil a dah yraM

Back to Filter List

Back to Liquid Reference for 0.11.4

 

 
Back to Documentation