简体   繁体   English

如何按字符拆分字符串 "

[英]How Can I split a string by the character "

在此处输入图像描述

That is what I have, and I tried to split like: (Using Golang)这就是我所拥有的,我尝试像这样拆分:(使用 Golang)

idPost = strings.Split(idPost,'"')

but the compiler said IncompatibleAssign using '"'.但是编译器说 IncompatibleAssign using '"'。

Use a back quote instead of an apostrophe, example:使用反引号代替撇号,例如:

idPost = strings.Split(idPost,`"`)

you need to escape it, so your question is how to escape characters in go .你需要转义它,所以你的问题是如何转义 go 中的字符

Escapes and multiline strings转义和多行字符串

You will find this is similar across many languages:你会发现这在许多语言中都是相似的:

dPost = strings.Split(idPost,"\"")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM