Skip to content

slice

Part of a string or array, from an index and a length.

Negative indexes count from the end. The length defaults to 1.

string | slice: start, length
Name Type Description
start (required) number First index (0-based; negative from the end).
length number How many characters or items (default 1).

string or array

Liquid
{{ 'Sooquna' | slice: 0, 4 }} {{ 'Sooquna' | slice: -3, 3 }}
Output
Sooq una

Shopify: Same as Shopify.

Since theme platform 1.0.

Was this page helpful?