private String[] splitSeparator(String sep,String s){
  Vector v=new Vector();
  int tokenStart=0;
  int tokenEnd=0;
  while ((tokenEnd=s.indexOf(sep,tokenStart)) != -1) {
    v.addElement(s.substring(tokenStart,tokenEnd));
    tokenStart=tokenEnd + 1;
  }
  v.addElement(s.substring(tokenStart));
  String[] retVal=new String[v.size()];
  v.copyInto(retVal);
  return retVal;
}

private String [ ] splitSeparator ( String sep , String s ) { Vector v = new Vector ( ) ; int tokenStart = 0 ; int tokenEnd = 0 ; while ( ( tokenEnd = s . indexOf ( sep , tokenStart ) ) != - 1 ) { v . addElement ( s . substring ( tokenStart , tokenEnd ) ) ; tokenStart = tokenEnd + 1 ; } v . addElement ( s . substring ( tokenStart ) ) ; String [ ] retVal = new String [ v . size ( ) ] ; v . copyInto ( retVal ) ; return retVal ; }
split a string based on the presence of a specified separator . returns an array of arbitrary length . the end of each element in the array is indicated by the separator of the end of the string . if there is a separator immediately before the end of the string , the final element will be empty . none of the strings will contain the separator . useful when separating strings such as " foo / bar / bas " using separator " / " .
