title |
linkTitle |
description |
categories |
keywords |
menu |
function |
relatedFunctions |
aliases |
collections.Delimit |
delimit |
Loops through any array, slice, or map and returns a string of all the values separated by a delimiter. |
|
|
|
aliases |
returnType |
signatures |
|
template.HTML |
collections.Delimit COLLECTION DELIMITER [LAST] |
|
|
collections.Apply |
collections.Delimit |
collections.In |
collections.Reverse |
collections.Seq |
collections.Slice |
strings.Split |
|
|
Delimit a slice:
{{ $s := slice "b" "a" "c" }}
{{ delimit $s ", " }} → "b, a, c"
{{ delimit $s ", " " and "}} → "b, a and c"
Delimit a map:
{{% note %}}
The delimit
function sorts maps by key, returning the values.
{{% /note %}}
{{ $m := dict "b" 2 "a" 1 "c" 3 }}
{{ delimit $m ", " }} → "1, 2, 3"
{{ delimit $m ", " " and "}} → "1, 2 and 3"