String Split Golang

huangapple go评论70阅读模式
英文:

String Split Golang

问题

我有一个存储了JSON数据的字符串,我想将数据分成两部分:

以下是字符串:

Data:{"Event": Hello,
"IsEventRunning": TRUE,
}
{"EventDetails": MG stan,"help": True
}

我想从"EventDetails"处将字符串分割,并将其保存在一个单独的变量中,请帮忙。

英文:

I have a string that has stored JSON data and i want to split the data in 2 parts:

Below is the string:

Data:{"Event": Hello,
"IsEventRunning": TRUE,
}
{"EventDetails": MG stan,"help": True
}

I want to break the string from "EventDetails" and save it in a separate variable, Kindly help

答案1

得分: 1

请使用以下链接:

Golang支持字符串的切割

https://gosamples.dev/split-string/

Strings.Cut将帮助您划分一个字符串,strings.Cut仅支持1.19以上的版本。

英文:

Please use below link:

Golang supports cutting of string

https://gosamples.dev/split-string/

Strings.Cut will help you dividing a string, strings.Cut supports only for versions above 1.19

huangapple
  • 本文由 发表于 2022年8月11日 03:43:43
  • 转载请务必保留本文链接:https://go.coder-hub.com/73311899.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定