join
¶
The join
filter returns a string which is the concatenation of the items
of a sequence:
結合フィルターは、シーケンスの項目を連結した文字列を返します。
1 2 |
{{ [1, 2, 3]|join }}
{# returns 123 #}
|
The separator between elements is an empty string per default, but you can define it with the optional first parameter:
要素間のセパレーターは、デフォルトでは空の文字列ですが、オプションの最初のパラメーターで定義できます。
1 2 |
{{ [1, 2, 3]|join('|') }}
{# outputs 1|2|3 #}
|
A second parameter can also be provided that will be the separator used between the last two items of the sequence:
シーケンスの最後の 2 つの項目間で使用されるセパレーターとなる 2 番目のパラメーターを指定することもできます。
1 2 |
{{ [1, 2, 3]|join(', ', ' and ') }}
{# outputs 1, 2 and 3 #}
|
Arguments ¶
glue
: The separator接着剤: セパレーターand
: The separator for the last pair of input itemsand: 入力項目の最後のペアのセパレーター