private static final String[] split(String path,String pat){
  ArrayList<String> comps=new ArrayList<String>();
  int pos=path.indexOf(pat);
  int start=0;
  while (pos >= 0) {
    if (pos > start) {
      String comp=path.substring(start,pos);
      comps.add(comp);
    }
    start=pos + pat.length();
    pos=path.indexOf(pat,start);
  }
  if (start < path.length()) {
    comps.add(path.substring(start));
  }
  String[] result=new String[comps.size()];
  for (int i=0; i < comps.size(); i++) {
    result[i]=comps.get(i);
  }
  return result;
}

private static final String [ ] split ( String path , String pat ) { ArrayList < String > comps = new ArrayList < String > ( ) ; int pos = path . indexOf ( pat ) ; int start = 0 ; while ( pos >= 0 ) { if ( pos > start ) { String comp = path . substring ( start , pos ) ; comps . add ( comp ) ; } start = pos + pat . length ( ) ; pos = path . indexOf ( pat , start ) ; } if ( start < path . length ( ) ) { comps . add ( path . substring ( start ) ) ; } String [ ] result = new String [ comps . size ( ) ] ; for ( int i = 0 ; i < comps . size ( ) ; i ++ ) { result [ i ] = comps . get ( i ) ; } return result ; }
splits a string into it ' s components .
