string - 如何在 go 模板中连接两个字符串?

我在 join two strings 找到了这个文档,但这在 go 模板中不起作用。

有没有办法在 go 模板中连接字符串?

最佳答案

使用 delimitslice 的组合,例如

{{ delimit (slice "foo" "bar" "buzz") ", " }}
<!-- returns the string "foo, bar, buzz" -->

最初来自gohugo docs

https://stackoverflow.com/questions/39023060/

相关文章:

html - 隐藏来自 HTML 电子邮件的预览文本的内容

java - 将 List> 转换为 int[][]

scala - Akka 流 : Can not write to file sink

laravel - 为什么在 Laravel 中注销路由不起作用?

python - 如何为使用 gmail 发送的电子邮件添加主题?

django - 不可散列类型 : 'list' error when trying to add

angular - 在 Angular 2 模板中使用普通 POST 表单会导致 : "Templa

python - 如何通过 Django 查看上传的文本文件?

fortran - IF 和 ENDIF 之前的 # 是什么意思

php - 使用 openssl_encrypt 代替 Mcrypt 进行 3DES-ECB 加密