collections.Delimit
Syntax
collections.Delimit COLLECTION DELIMITER [LAST]
Returns
string
Alias
delimit
对切片进行分隔:
{{ $s := slice "b" "a" "c" }}
{{ delimit $s ", " }} → b, a, c
{{ delimit $s ", " " and "}} → b, a and c
对映射进行分隔:
{{ $m := dict "b" 2 "a" 1 "c" 3 }}
{{ delimit $m ", " }} → 1, 2, 3
{{ delimit $m ", " " and "}} → 1, 2 and 3