StringUtilities { public static String escape(String source) { return escape(source, '\0'); }  static String escape(String source); static String escape(String source, char delimiter); static String unescape(String source); static String implode(String[] array, String sepString); static String implodeMultiline(List<String> lines); static String truncateSequencesIfNecessary(String text, int maxConsecutiveLength); static String stripSuffix(String string, String suffix); static String quote(Object object); static Set<String> split(String s);  }
@Test public void testEscape() { assertEquals("abz019ABZ", StringUtilities.escape("abz019ABZ")); assertEquals("\\t", StringUtilities.escape("\t")); assertEquals("\\n", StringUtilities.escape("\n")); assertEquals("\\r", StringUtilities.escape("\r")); assertEquals("\\\"", StringUtilities.escape("\"")); assertEquals("\\f", StringUtilities.escape("\f")); assertEquals("\\\\", StringUtilities.escape("\\")); assertEquals("\\x05", StringUtilities.escape("" + (char) 5)); assertEquals("\\tA\\ncombined\\r\\x055test", StringUtilities.escape("\tA\ncombined\r" + ((char) 5) + "5test")); assertEquals("A\\x20space\\x20separated\\x20string", StringUtilities.escape("A space separated string", ' ')); }