slice

Filter = slice

Returns a substring of 1 character beginning at the index specified by the first argument. An optional second argument specifies the length of the substring to be returned.

String indices are numbered starting from 0.

INPUT

OUTPUT

{{ "Liquid" | slice: 0 }}

L

INPUT

OUTPUT

{{ "Liquid" | slice: 2 }}

q

INPUT

OUTPUT

{{ "Liquid" | slice: 2, 5 }}

quid

If the first argument is a negative number, the indices are counted from the end of the string:

INPUT

OUTPUT

{{ "Liquid" | slice: -3, 2 }}

ui