Files
hugo/docs/content/en/functions/collections/Delimit.md
T
Bjørn Erik Pedersen 30a20122b7 Merge commit '8f3c066d23f431fb2c53d97ea489e4c28b42bd82'
# Conflicts:
#	docs/data/docs.yaml
2026-02-14 12:14:33 +01:00

32 lines
717 B
Markdown

---
title: collections.Delimit
description: Returns a string by joining the values of the given slice or map with a delimiter.
categories: []
keywords: []
params:
functions_and_methods:
aliases: [delimit]
returnType: string
signatures: ['collections.Delimit SLICE|MAP DELIMITER [LAST]']
aliases: [/functions/delimit]
---
Delimit a slice:
```go-html-template
{{ $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.
```go-html-template
{{ $m := dict "b" 2 "a" 1 "c" 3 }}
{{ delimit $m ", " }} → 1, 2, 3
{{ delimit $m ", " " and "}} → 1, 2 and 3
```