dap4/d4core/src/main/java/dap4/core/util/Escape.java
static public List<String>
    backslashsplit(String s, char sep)
    {
        List<String> path = new ArrayList<String>();
        int len = s.length();
        StringBuilder piece = new StringBuilder();
        int i = 0;
        for(; i <= len - 1; i++) {
            char c = s.charAt(i);
            if(c == '\\' && i < (len - 1)) {
                piece.append(c); // keep escapes in place
                piece.append(s.charAt(++i));
            } else if(c == sep) {
                path.add(piece.toString());
                piece.setLength(0);
            } else
                piece.append(c);
        }
        path.add(piece.toString());
        return path;
    }
static public List<String>
    backslashsplit(String s, char sep)
    {
        List<String> path = new ArrayList<String>();
        int len = s.length();
        StringBuilder piece = new StringBuilder();
        int i = 0;
        for(; i <= len - 1; i++) {
            char c = s.charAt(i);
            if(c == '\\' && i < (len - 1)) {
                piece.append(c); // keep escapes in place
                piece.append(s.charAt(++i));
            } else if(c == sep) {
                path.add(piece.toString());
                piece.setLength(0);
            } else
                piece.append(c);
        }
        path.add(piece.toString());
        return path;
    }
static public List < String > backslashsplit ( String s , char sep ) { List < String > path = new ArrayList < String > ( ) ; int len = s . length ( ) ; StringBuilder piece = new StringBuilder ( ) ; int i = 0 ; for ( ; i <= len - 1 ; i ++ ) { char c = s . charAt ( i ) ; if ( c == ' ' && i < ( len - 1 ) ) { piece . append ( c ) ; // keep escapes in place piece . append ( s . charAt ( ++ i ) ) ; } else if ( c == sep ) { path . add ( piece . toString ( ) ) ; piece . setLength ( 0 ) ; } else piece . append ( c ) ; } path . add ( piece . toString ( ) ) ; return path ; }
Split a string with respect to a separator
character and taking backslashes into consideration.

@param s   The string to split
@param sep The character on which to split
@return a List of strings (all with escaping still intact)
representing s split at unescaped instances of sep.
Split a string with respect to a separator character and taking backslashes into consideration .