Escaping javascript string in java

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-28 00:45:57
Denys Séguret

Apache commons have a methods just for this in StringEscapeUtils : the escapeJavaScript method.

Looks like it was moved in Apache Commons Lang 3 to ESCAPE_ECMASCRIPT in StringEscapeUtils.

https://commons.apache.org/proper/commons-lang/javadocs/api-3.4/src-html/org/apache/commons/lang3/StringEscapeUtils.html#line.74

It seems it moved yet again, now it is part of "commons-text" and is named:

StringEscapeUtils.escapeEcmaScript

But good it still exists.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!