strings

strings.Chomp

返回给定字符串,并删除末尾的所有换行符与回车符。

签名
strings.Chomp STRING
返回类型
any
别名
chomp

如果参数的类型是 template.HTML,则返回 template.HTML;否则返回 string。

{{ chomp "foo\n" }} → foo
{{ chomp "foo\n\n" }} → foo

{{ chomp "foo\r\n" }} → foo
{{ chomp "foo\r\n\r\n" }} → foo