String strFCKeditor1 = request.getParameter("FCKeditor1");
我想读取此 (strFCKeditor1) 字符串,并希望将其中的 "
替换为 \"
。
我该怎么做?
最佳答案
尝试
strFCKeditor1 = strFCKeditor1.replace("\"", "\\\"");
这是“Java 字符串转义”方式,表示将 "
替换为 \"
来自replace
的文档:
Replaces each substring of this string that matches the literal target sequence with the specified literal replacement sequence.
关于java - JSP中读取字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4826072/