Home > Back-end >  How Can I split a string by the character "
How Can I split a string by the character "

Time:02-19

enter image description here

That is what I have, and I tried to split like: (Using Golang)

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

but the compiler said IncompatibleAssign using '"'.

CodePudding user response:

Use a back quote instead of an apostrophe, example:

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

CodePudding user response:

you need to escape it, so your question is how to escape characters in go.

Escapes and multiline strings

You will find this is similar across many languages:

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