public static String[] splitc(String src,char[] delimiters){
  if ((delimiters.length == 0) || (src.length() == 0)) {
    return new String[]{src};
  }
  char[] srcc=src.toCharArray();
  int maxparts=srcc.length + 1;
  int[] start=new int[maxparts];
  int[] end=new int[maxparts];
  int count=0;
  start[0]=0;
  int s=0, e;
  if (CharUtil.equalsOne(srcc[0],delimiters) == true) {
    end[0]=0;
    count++;
    s=CharUtil.findFirstDiff(srcc,1,delimiters);
    if (s == -1) {
      return new String[]{EMPTY,EMPTY};
    }
    start[1]=s;
  }
  while (true) {
    e=CharUtil.findFirstEqual(srcc,s,delimiters);
    if (e == -1) {
      end[count]=srcc.length;
      break;
    }
    end[count]=e;
    count++;
    s=CharUtil.findFirstDiff(srcc,e,delimiters);
    if (s == -1) {
      start[count]=end[count]=srcc.length;
      break;
    }
    start[count]=s;
  }
  count++;
  String[] result=new String[count];
  for (int i=0; i < count; i++) {
    result[i]=src.substring(start[i],end[i]);
  }
  return result;
}

public static String [ ] splitc ( String src , char [ ] delimiters ) { if ( ( delimiters . length == 0 ) || ( src . length ( ) == 0 ) ) { return new String [ ] { src } ; } char [ ] srcc = src . toCharArray ( ) ; int maxparts = srcc . length + 1 ; int [ ] start = new int [ maxparts ] ; int [ ] end = new int [ maxparts ] ; int count = 0 ; start [ 0 ] = 0 ; int s = 0 , e ; if ( CharUtil . equalsOne ( srcc [ 0 ] , delimiters ) == true ) { end [ 0 ] = 0 ; count ++ ; s = CharUtil . findFirstDiff ( srcc , 1 , delimiters ) ; if ( s == - 1 ) { return new String [ ] { EMPTY , EMPTY } ; } start [ 1 ] = s ; } while ( true ) { e = CharUtil . findFirstEqual ( srcc , s , delimiters ) ; if ( e == - 1 ) { end [ count ] = srcc . length ; break ; } end [ count ] = e ; count ++ ; s = CharUtil . findFirstDiff ( srcc , e , delimiters ) ; if ( s == - 1 ) { start [ count ] = end [ count ] = srcc . length ; break ; } start [ count ] = s ; } count ++ ; String [ ] result = new String [ count ] ; for ( int i = 0 ; i < count ; i ++ ) { result [ i ] = src . substring ( start [ i ] , end [ i ] ) ; } return result ; }
splits a string in several parts ( tokens ) that are separated by delimiter characters . delimiter may contains any number of character and it is always surrounded by two strings .
