reverse - Liquid Filter Reference - 1.0.0

Filter Name reverse
Group Arrays
Version 1.0.0

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 1.0.0

 

 
Back to Documentation