hugo/docs/content/en/functions/collections/Delimit.md
Bjørn Erik Pedersen 5fd1e74903
Merge commit '9b0050e9aabe4be65c78ccf292a348f309d50ccd' as 'docs'
```
git subtree add --prefix=docs/ https://github.com/gohugoio/hugoDocs.git master --squash
```

Closes #11925
2024-01-27 10:48:57 +01:00

764 B

title description categories keywords action aliases
collections.Delimit Loops through any array, slice, or map and returns a string of all the values separated by a delimiter.
aliases related returnType signatures
delimit
functions/strings/Split
string
collections.Delimit COLLECTION DELIMITER [LAST]
/functions/delimit

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