如何转换其中包含单个字符串数组的单个字符串。
func main() {
stringArrayInString := "[\"Hello\",\"Hai\",\"How are you!\"]" //Single string which has string array in it
fmt.Println(stringArrayInString)
// code to convert to the string array
// convertedString
}
输出必须是这样的
convertedString[0] = "Hello"
convertedString[1] = "Hai"
convertedString[2] = "How are you!"
如果上面的输入字符串有 int、string、JSON 类型等混合数据类型是否可以
stringArrayInString := "[\"Hello\",\"{\"msg\":\"Hai\"}\",123]"
//after converting
convertedString[0] = "Hello"
convertedString[1] = "{\"msg\":\"Hai\"}"
convertedString[2] = 123
慕运维8079593
相关分类