有没有办法逃避单引号?
下列:
str := "I'm Bob,and I'm 25." str = strings.Replace(str,"'","\'",-1)
给出错误:未知的转义序列:’
我想成为
"I\'m Bob,and I\'m 25."
你还需要在strings.Replace中转义斜杠.
str := "I'm Bob,"\\'",-1)