nd4j-common/src/main/java/org/nd4j/util/StringUtils.java
public static int findNext(String str, char separator, char escapeChar,
                               int start, StringBuilder split) {
        int numPreEscapes = 0;
        for (int i = start; i < str.length(); i++) {
            char curChar = str.charAt(i);
            if (numPreEscapes == 0 && curChar == separator) { // separator
                return i;
            } else {
                split.append(curChar);
                numPreEscapes = (curChar == escapeChar)
                        ? (++numPreEscapes) % 2
                        : 0;
            }
        }
        return -1;
    }
public static int findNext(String str, char separator, char escapeChar,
                               int start, StringBuilder split) {
        int numPreEscapes = 0;
        for (int i = start; i < str.length(); i++) {
            char curChar = str.charAt(i);
            if (numPreEscapes == 0 && curChar == separator) { // separator
                return i;
            } else {
                split.append(curChar);
                numPreEscapes = (curChar == escapeChar)
                        ? (++numPreEscapes) % 2
                        : 0;
            }
        }
        return -1;
    }
public static int findNext ( String str , char separator , char escapeChar , int start , StringBuilder split ) { int numPreEscapes = 0 ; for ( int i = start ; i < str . length ( ) ; i ++ ) { char curChar = str . charAt ( i ) ; if ( numPreEscapes == 0 && curChar == separator ) { // separator return i ; } else { split . append ( curChar ) ; numPreEscapes = ( curChar == escapeChar ) ? ( ++ numPreEscapes ) % 2 : 0 ; } } return - 1 ; }
Finds the first occurrence of the separator character ignoring the escaped
separators starting from the index. Note the substring between the index
and the position of the separator is passed.
@param str the source string
@param separator the character to find
@param escapeChar character used to escape
@param start from where to search
@param split used to pass back the extracted string
Finds the first occurrence of the separator character ignoring the escaped separators starting from the index . Note the substring between the index and the position of the separator is passed .