@Test public void testUnescape() { String string = StringEscaper.unescape(ESCAPED_STRING); assertEquals(UNESCAPED_STRING, string); }
public static String unescape(String escapedString) { StringBuilder sb = new StringBuilder(); boolean escaped = false; for (int i = 0; i < escapedString.length(); i++) { if (escaped) { escaped = false; sb.append(unescapeSequence(escapedString.subSequence(i - 1, i + 1))); } else if (escapedString.charAt(i) == ESCAPE_CHARACTER) { escaped = true; } else { sb.append(escapedString.charAt(i)); } } return sb.toString(); }
StringEscaper { public static String unescape(String escapedString) { StringBuilder sb = new StringBuilder(); boolean escaped = false; for (int i = 0; i < escapedString.length(); i++) { if (escaped) { escaped = false; sb.append(unescapeSequence(escapedString.subSequence(i - 1, i + 1))); } else if (escapedString.charAt(i) == ESCAPE_CHARACTER) { escaped = true; } else { sb.append(escapedString.charAt(i)); } } return sb.toString(); } }
StringEscaper { public static String unescape(String escapedString) { StringBuilder sb = new StringBuilder(); boolean escaped = false; for (int i = 0; i < escapedString.length(); i++) { if (escaped) { escaped = false; sb.append(unescapeSequence(escapedString.subSequence(i - 1, i + 1))); } else if (escapedString.charAt(i) == ESCAPE_CHARACTER) { escaped = true; } else { sb.append(escapedString.charAt(i)); } } return sb.toString(); }  }
StringEscaper { public static String unescape(String escapedString) { StringBuilder sb = new StringBuilder(); boolean escaped = false; for (int i = 0; i < escapedString.length(); i++) { if (escaped) { escaped = false; sb.append(unescapeSequence(escapedString.subSequence(i - 1, i + 1))); } else if (escapedString.charAt(i) == ESCAPE_CHARACTER) { escaped = true; } else { sb.append(escapedString.charAt(i)); } } return sb.toString(); }  static String escape(String string, Set<Character> escapedCharacters); static String unescape(String escapedString); static String[] split(String escapedString, String delimiter); static String[] split(String escapedString, String delimiter, int limit); }
StringEscaper { public static String unescape(String escapedString) { StringBuilder sb = new StringBuilder(); boolean escaped = false; for (int i = 0; i < escapedString.length(); i++) { if (escaped) { escaped = false; sb.append(unescapeSequence(escapedString.subSequence(i - 1, i + 1))); } else if (escapedString.charAt(i) == ESCAPE_CHARACTER) { escaped = true; } else { sb.append(escapedString.charAt(i)); } } return sb.toString(); }  static String escape(String string, Set<Character> escapedCharacters); static String unescape(String escapedString); static String[] split(String escapedString, String delimiter); static String[] split(String escapedString, String delimiter, int limit);  }