如何在Golang中为字符串添加单引号?
文章目录
我在Go中有一个字符串切片,我想将其表示为逗号分隔的字符串。这是切片
example := []string{"apple", "Bear", "kitty"}如何输出字符串 'apple', 'Bear', 'kitty'
commaSep := "'" + strings.Join(example, "', '") + "'"我在Go中有一个字符串切片,我想将其表示为逗号分隔的字符串。这是切片
example := []string{"apple", "Bear", "kitty"}如何输出字符串 'apple', 'Bear', 'kitty'
commaSep := "'" + strings.Join(example, "', '") + "'"
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论