Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在我下载 json 对象的 java 程序中,当我从中获取一个字符串时,它会像"what\'s"例如,即使在 PHP 中我输入了"what's". 它有反斜杠来转义引号和可能的其他字符。有没有我可以用来取消转义并将其转换为的 java 函数"what's"?
"what\'s"
"what's"
JSONObject object = new JSONObject(response); firstname = object.getString("firstname");
如果您要删除反斜杠,请使用String.replace()方法将所有内容替换\为空子字符串。
String.replace()
\
我认为它是这样的
String s = yourString.replace("\\","");