@Test public void testEscape() { String escapedString = StringEscaper.escape(UNESCAPED_STRING, ESCAPED_CHARACTERS); assertEquals(ESCAPED_STRING, escapedString); }
public static String escape(String string, Set<Character> escapedCharacters) { StringBuilder sb = new StringBuilder(); for (char c : string.toCharArray()) { if (escapedCharacters.contains(c)) { sb.append(escapeCharacter(c)); } else { sb.append(c); } } return sb.toString(); }
StringEscaper { public static String escape(String string, Set<Character> escapedCharacters) { StringBuilder sb = new StringBuilder(); for (char c : string.toCharArray()) { if (escapedCharacters.contains(c)) { sb.append(escapeCharacter(c)); } else { sb.append(c); } } return sb.toString(); } }
StringEscaper { public static String escape(String string, Set<Character> escapedCharacters) { StringBuilder sb = new StringBuilder(); for (char c : string.toCharArray()) { if (escapedCharacters.contains(c)) { sb.append(escapeCharacter(c)); } else { sb.append(c); } } return sb.toString(); }  }
StringEscaper { public static String escape(String string, Set<Character> escapedCharacters) { StringBuilder sb = new StringBuilder(); for (char c : string.toCharArray()) { if (escapedCharacters.contains(c)) { sb.append(escapeCharacter(c)); } else { sb.append(c); } } 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 escape(String string, Set<Character> escapedCharacters) { StringBuilder sb = new StringBuilder(); for (char c : string.toCharArray()) { if (escapedCharacters.contains(c)) { sb.append(escapeCharacter(c)); } else { sb.append(c); } } 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);  }