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) {
      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 ) { 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 .
