blob: d57be66e69638006c9c62767dbecb5f347277a69 [file] [log] [blame]
Matthias Andreas Benkard12a57352021-12-28 18:02:04 +01001``join``
2========
3
4The ``join`` filter returns a string which is the concatenation of the items
5of a sequence:
6
7.. code-block:: twig
8
9 {{ [1, 2, 3]|join }}
10 {# returns 123 #}
11
12The separator between elements is an empty string per default, but you can
13define it with the optional first parameter:
14
15.. code-block:: twig
16
17 {{ [1, 2, 3]|join('|') }}
18 {# outputs 1|2|3 #}
19
20A second parameter can also be provided that will be the separator used between
21the last two items of the sequence:
22
23.. code-block:: twig
24
25 {{ [1, 2, 3]|join(', ', ' and ') }}
26 {# outputs 1, 2 and 3 #}
27
28Arguments
29---------
30
31* ``glue``: The separator
32* ``and``: The separator for the last pair of input items