/** * Reverse XML quoting to recover the original string. * * @param x string to quote * @return equivilent string */ static public String unquoteXmlContent(String x) { return unreplace(x, xmlOutC, xmlInC); }
/** * Reverse XML quoting to recover the original string. * * @param x string to quote * @return equivilent string */ static public String unquoteXmlAttribute(String x) { return unreplace(x, xmlOut, xmlIn); }
/** * Reverse XML quoting to recover the original string. * * @param x string to quote * @return equivilent string */ static public String unquoteXmlAttribute(String x) { return unreplace(x, xmlOut, xmlIn); }
/** * Reverse XML quoting to recover the original string. * * @param x string to quote * @return equivilent string */ static public String unquoteXmlContent(String x) { return StringUtil2.unreplace(x, xmlOutC, xmlInC); }
/** * Reverse XML quoting to recover the original string. * * @param x string to quote * @return equivilent string */ static public String unquoteXmlContent(String x) { return unreplace(x, xmlOutC, xmlInC); }
/** * Reverse XML quoting to recover the original string. * * @param x string to quote * @return equivilent string */ static public String unquoteXmlContent(String x) { return StringUtil2.unreplace(x, xmlOutC, xmlInC); }
/** * Replace all occurences of orgReplace with orgChar; inverse of replace(). * * @param x operate on this string * @param orgReplace get rid of these * @param orgChar replace with these * @return resulting string */ static public String unreplace(String x, String[] orgReplace, char[] orgChar) { // common case no replacement boolean ok = true; for (int i = 0; i < orgReplace.length; i++) { int pos = x.indexOf(orgReplace[i]); ok = (pos < 0); if (!ok) break; } if (ok) return x; // gotta do it StringBuilder result = new StringBuilder(x); for (int i = 0; i < orgReplace.length; i++) { int pos = result.indexOf(orgReplace[i]); if (pos >= 0) { unreplace(result, orgReplace[i], orgChar[i]); } } return result.toString(); }
/** * Replace all occurences of orgReplace with orgChar; inverse of replace(). * * @param x operate on this string * @param orgReplace get rid of these * @param orgChar replace with these * @return resulting string */ static public String unreplace(String x, String[] orgReplace, char[] orgChar) { // common case no replacement boolean ok = true; for (String anOrgReplace : orgReplace) { int pos = x.indexOf(anOrgReplace); ok = (pos < 0); if (!ok) break; } if (ok) return x; // gotta do it StringBuilder result = new StringBuilder(x); for (int i = 0; i < orgReplace.length; i++) { int pos = result.indexOf(orgReplace[i]); if (pos >= 0) { unreplace(result, orgReplace[i], orgChar[i]); } } return result.toString(); }
/** * Replace all occurrences of orgReplace with orgChar; inverse of replace(). * * @param x operate on this string * @param orgReplace get rid of these * @param orgChar replace with these * @return resulting string */ static public String unreplace(String x, String[] orgReplace, char[] orgChar) { // common case no replacement boolean ok = true; for (String anOrgReplace : orgReplace) { int pos = x.indexOf(anOrgReplace); ok = (pos < 0); if (!ok) break; } if (ok) return x; // gotta do it StringBuilder result = new StringBuilder(x); for (int i = 0; i < orgReplace.length; i++) { int pos = result.indexOf(orgReplace[i]); if (pos >= 0) { unreplace(result, orgReplace[i], orgChar[i]); } } return result.toString(); }