输入:
// a slice of type string.
data := []string{"one", "two", "three"}
预期输出:
["one","two","three"]
我尝试使用这些格式说明符 https://play.golang.org/p/zBcFAh7YoVn
fmt.Printf("%+q\n", data)
fmt.Printf("%#q\n", data)
fmt.Printf("%q\n", data)
// using strings.Join()
result := strings.Join(data, ",")
fmt.Println(result)
输出: 所有值都没有逗号,
["one" "two" "three"]
[`one` `two` `three`]
["one" "two" "three"]
one,two,three
白衣非少年
jeck猫
白板的微信
相关分类