EscapeUtil { public static String escape(String pArg, String pEscape, String pDelimiter) { return pArg.replaceAll(pEscape, pEscape + pEscape).replaceAll(pDelimiter, pEscape + pDelimiter); } private  EscapeUtil(); static String combineToPath(List<String> pParts); static List<String> parsePath(String pPath); static Stack<String> extractElementsFromPath(String pPath); static Stack<String> reversePath(List<String> pathParts); static List<String> split(String pArg, String pEscape, String pDelimiter); static String[] splitAsArray(String pArg, String pEscape, String pDelimiter); static String escape(String pArg, String pEscape, String pDelimiter); static final String PATH_ESCAPE; static final String CSV_ESCAPE; }
@Test public void escaping() { assertEquals(EscapeUtil.escape("hello\\world,how are you?",CSV_ESCAPE,","),"hello\\\\world\\,how are you?"); }