'How Can I split a string by the character "

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 '"'.



Solution 1:[1]

Use a back quote instead of an apostrophe, example:

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

Solution 2:[2]

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,"\"")

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Timofey Belanenko
Solution 2 Chris Schaller