@Test(dataProvider = "strings") public void escape(final String original, final String escaped) { final String esc = ESCAPER.escape(original); final String orig = ESCAPER.unescape(esc); Assert.assertEquals(esc, escaped); Assert.assertEquals(orig, original); }
public String escape(final CharSequence value) { final StringBuilder result = new StringBuilder(); for (int i = 0; i < value.length(); ++i) { final char c = value.charAt(i); if (isProtectedChar(c)) { result.append(_escape); } result.append(c); } return result.toString(); }
Escaper { public String escape(final CharSequence value) { final StringBuilder result = new StringBuilder(); for (int i = 0; i < value.length(); ++i) { final char c = value.charAt(i); if (isProtectedChar(c)) { result.append(_escape); } result.append(c); } return result.toString(); } }
Escaper { public String escape(final CharSequence value) { final StringBuilder result = new StringBuilder(); for (int i = 0; i < value.length(); ++i) { final char c = value.charAt(i); if (isProtectedChar(c)) { result.append(_escape); } result.append(c); } return result.toString(); } Escaper(final char escape, final char... protect); }
Escaper { public String escape(final CharSequence value) { final StringBuilder result = new StringBuilder(); for (int i = 0; i < value.length(); ++i) { final char c = value.charAt(i); if (isProtectedChar(c)) { result.append(_escape); } result.append(c); } return result.toString(); } Escaper(final char escape, final char... protect); String escape(final CharSequence value); String unescape(final CharSequence value); }
Escaper { public String escape(final CharSequence value) { final StringBuilder result = new StringBuilder(); for (int i = 0; i < value.length(); ++i) { final char c = value.charAt(i); if (isProtectedChar(c)) { result.append(_escape); } result.append(c); } return result.toString(); } Escaper(final char escape, final char... protect); String escape(final CharSequence value); String unescape(final CharSequence value);  }