# collections.Delimit
> 用指定的分隔符连接给定切片或映射中的值，返回一个字符串。
- 官方英文原文：https://gohugo.io/functions/collections/delimit/
- 本页规范地址：https://hugozh.cn/functions/collections/delimit/
- 最近更新：2026-10-02
- 最后提交：912b1d3 chore(site): 添加 static/CNAME（hugozh.cn），供 GitHub Pages 等平台绑定自定义域名
- 签名：collections.Delimit SLICE|MAP DELIMITER [LAST]
- 返回类型：string
- 站点：Hugo 中文文档（https://hugozh.cn/）· 社区维护的非官方中文翻译，如有出入以官方英文原文为准

---
连接切片：

```go-html-template
{{ $s := slice "b" "a" "c" }}
{{ delimit $s ", " }} → b, a, c
{{ delimit $s ", " " and "}} → b, a and c
```

连接映射：

> [!NOTE]
> `delimit` 函数会先按 key 对映射排序，然后返回它的值。

```go-html-template
{{ $m := dict "b" 2 "a" 1 "c" 3 }}
{{ delimit $m ", " }} → 1, 2, 3
{{ delimit $m ", " " and "}} → 1, 2 and 3
```

