public static String[] split(String s,String sep,boolean caseInsensitive){
  String splitString=caseInsensitive ? sep.toLowerCase() : sep;
  String input=caseInsensitive ? s.toLowerCase() : s;
  int i, b, e;
  int cnt;
  String res[];
  int ln=s.length();
  int sln=sep.length();
  if (sln == 0)   throw new IllegalArgumentException("The separator string has 0 length");
  i=0;
  cnt=1;
  while ((i=input.indexOf(splitString,i)) != -1) {
    cnt++;
    i+=sln;
  }
  res=new String[cnt];
  i=0;
  b=0;
  while (b <= ln) {
    e=input.indexOf(splitString,b);
    if (e == -1)     e=ln;
    res[i++]=s.substring(b,e);
    b=e + sln;
  }
  return res;
}

public static String [ ] split ( String s , String sep , boolean caseInsensitive ) { String splitString = caseInsensitive ? sep . toLowerCase ( ) : sep ; String input = caseInsensitive ? s . toLowerCase ( ) : s ; int i , b , e ; int cnt ; String res [ ] ; int ln = s . length ( ) ; int sln = sep . length ( ) ; if ( sln == 0 ) throw new IllegalArgumentException ( "The separator string has 0 length" ) ; i = 0 ; cnt = 1 ; while ( ( i = input . indexOf ( splitString , i ) ) != - 1 ) { cnt ++ ; i += sln ; } res = new String [ cnt ] ; i = 0 ; b = 0 ; while ( b <= ln ) { e = input . indexOf ( splitString , b ) ; if ( e == - 1 ) e = ln ; res [ i ++ ] = s . substring ( b , e ) ; b = e + sln ; } return res ; }
splits a string at the specified string .
