v1.9.1
Reverses the order of the items in an array. reverse cannot reverse a string.
Input
1 | {% assign my_array = "apples, oranges, peaches, plums" | split: ", " %} |
Output
1 |
|
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:
Input
1 | {{ "Ground control to Major Tom." | split: "" | reverse | join: "" }} |
Output
1 | .moT rojaM ot lortnoc dnuorG |