private static String[] fracture(String str,String sep){
  if (str.length() == 0) {
    return new String[0];
  }
  ArrayList<String> res=new ArrayList<String>();
  int in=0;
  int curPos=0;
  int i=str.indexOf(sep);
  int len=sep.length();
  while (i != -1) {
    String s=str.substring(curPos,i);
    res.add(s);
    in++;
    curPos=i + len;
    i=str.indexOf(sep,curPos);
  }
  len=str.length();
  if (curPos <= len) {
    String s=str.substring(curPos,len);
    in++;
    res.add(s);
  }
  return res.toArray(new String[in]);
}

private static String [ ] fracture ( String str , String sep ) { if ( str . length ( ) == 0 ) { return new String [ 0 ] ; } ArrayList < String > res = new ArrayList < String > ( ) ; int in = 0 ; int curPos = 0 ; int i = str . indexOf ( sep ) ; int len = sep . length ( ) ; while ( i != - 1 ) { String s = str . substring ( curPos , i ) ; res . add ( s ) ; in ++ ; curPos = i + len ; i = str . indexOf ( sep , curPos ) ; } len = str . length ( ) ; if ( curPos <= len ) { String s = str . substring ( curPos , len ) ; in ++ ; res . add ( s ) ; } return res . toArray ( new String [ in ] ) ; }
helper method to avoid stringtokenizer using .
