/** * Escape single and double quotes so that they can be part of e.g. an alert call. * * @param input input * @return Escaped version of the input */ public static CharSequence escapeQuotes(final CharSequence input) { CharSequence s = input; if (s != null) { s = Strings.replaceAll(s, "'", "\\'"); s = Strings.replaceAll(s, "\"", "\\\""); } return s; }
protected CharSequence encode(CharSequence str) { return Strings.replaceAll(str, "]]>", "]]]]><![CDATA[>"); }