split Filter
Divides a string into an array based on a delimiter.
Parameters
| Parameter | Required | Description |
|---|---|---|
delimiter
|
Yes |
string Substring to use as a divider for splitting the string into an array.
|
Category
Description
The split filter allows you to split a string into an array by specifying a substring
as the divider.
A common use case is to split up words by using a space as the delimiter:
{% assign words = 'The quick brown fox jumped over the lazy dog.' | split: ' ' %}
{{ word | first }}
{{ word | last }}
Output
The dog.