join

The join filter concatenates the values of an array together, optionally separated by one or more characters. 

{{ [1, 2, 3]|join }}

The above would output: 123

{{ [1, 2, 3]|join(' | ') }}

The above would output: 1 | 2 | 3

Arguments

The join filter has the following signature.

join(glue)

Argument Description
glue

The string to separate each value of the array as they are joined together. 

The separator value can be one or more characters.

{{ [1, 2, 3]|join(',') }}

The above would output: 1,2,3

{{ ['cat', 'dog', 'fish']|join('my ') }}

The above would output: my cat my dog my fish

You could also pass an empty string.

{{ [1, 2, 3]|join(' ') }}

The above would output: 1 2 3

< Back to the list of filters