@Test public void testEscape() { assertEquals("Hello\\\\nWorld!", StringUtil.escape("Hello\\nWorld!")); assertEquals("Hello\\nWorld!", StringUtil.escape("Hello\nWorld!")); assertEquals("\\r\tHello\\nWorld!", StringUtil.escape("\r\tHello\nWorld!")); assertEquals("Hello\\\\\\nWorld!", StringUtil.escape("Hello\\\nWorld!")); assertEquals("Hello\tWorld", StringUtil.escape("Hello\tWorld")); assertEquals("Hello\\\\World!", StringUtil.escape("Hello\\World!")); }
public static String escape(String original) { if (original != null) { return original.replace("\\", "\\\\").replace("\r", "\\r").replace("\n", "\\n"); } else { return null; } }
StringUtil { public static String escape(String original) { if (original != null) { return original.replace("\\", "\\\\").replace("\r", "\\r").replace("\n", "\\n"); } else { return null; } } }
StringUtil { public static String escape(String original) { if (original != null) { return original.replace("\\", "\\\\").replace("\r", "\\r").replace("\n", "\\n"); } else { return null; } }  }
StringUtil { public static String escape(String original) { if (original != null) { return original.replace("\\", "\\\\").replace("\r", "\\r").replace("\n", "\\n"); } else { return null; } }  static String escape(String original); static String unescape(String escaped); }
StringUtil { public static String escape(String original) { if (original != null) { return original.replace("\\", "\\\\").replace("\r", "\\r").replace("\n", "\\n"); } else { return null; } }  static String escape(String original); static String unescape(String escaped); final static char ESCAPE_CHAR; }