1 Star 1 Fork 0

k3x/urlx

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
utils.go 530 Bytes
一键复制 编辑 原始数据 按行查看 历史
k3x 提交于 3年前 . sync
package html
import (
"io"
"github.com/valyala/fasttemplate"
)
func noExTag(params map[string]string) func(w io.Writer, tag string) (n int, err error) {
return func(w io.Writer, tag string) (n int, err error) {
if params != nil {
if v := params[tag]; v != "" {
n, err = w.Write([]byte(v))
}
}
return
}
}
// ReplaceTemplate 模板替换
func ReplaceTemplate(template string, params map[string]string) (s string) {
s, _ = fasttemplate.ExecuteFuncStringWithErr(template, "{", "}", noExTag(params))
return
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/k3x/urlx.git
git@gitee.com:k3x/urlx.git
k3x
urlx
urlx
648a86ee4400

搜索帮助