collections.Delimit
Loops through any array, slice, or map and returns a string of all the values separated by a delimiter.
Syntax
collections.Delimit COLLECTION DELIMITER [LAST]
Returns
string
Alias
delimit
Delimit a slice:
{{ $s := slice "b" "a" "c" }}
{{ delimit $s ", " }} → b, a, c
{{ delimit $s ", " " and "}} → b, a and c
Delimit a map:
The delimit
function sorts maps by key, returning the values.
{{ $m := dict "b" 2 "a" 1 "c" 3 }}
{{ delimit $m ", " }} → 1, 2, 3
{{ delimit $m ", " " and "}} → 1, 2 and 3
Last updated:
January 26, 2024
:
Squashed 'docs/' changes from 4dd2d6415..3b1a8579d (7125ad401)
Improve this page