public static String[] parseDelimitedList(String list,char delimiter){
  String delim="" + delimiter;
  StringTokenizer st=new StringTokenizer(list + delim + " ",delim,true);
  ArrayList<String> v=new ArrayList<String>();
  String lastToken="";
  String word="";
  while (st.hasMoreTokens()) {
    String tok=st.nextToken();
    if (lastToken != null) {
      if (tok.equals(delim)) {
        word=word + lastToken;
        if (lastToken.equals(delim))         tok=null;
      }
 else {
        if (!word.equals(""))         v.add(word);
        word="";
      }
    }
    lastToken=tok;
  }
  return v.toArray(new String[0]);
}

public static String [ ] parseDelimitedList ( String list , char delimiter ) { String delim = "" + delimiter ; StringTokenizer st = new StringTokenizer ( list + delim + " " , delim , true ) ; ArrayList < String > v = new ArrayList < String > ( ) ; String lastToken = "" ; String word = "" ; while ( st . hasMoreTokens ( ) ) { String tok = st . nextToken ( ) ; if ( lastToken != null ) { if ( tok . equals ( delim ) ) { word = word + lastToken ; if ( lastToken . equals ( delim ) ) tok = null ; } else { if ( ! word . equals ( "" ) ) v . add ( word ) ; word = "" ; } } lastToken = tok ; } return v . toArray ( new String [ 0 ] ) ; }
parse a list of substrings separated by a given delimiter . the delimiter can also appear in substrings ( just double them ) : parsedelimitedstring ( " this | is " , ' | ' ) returns [ " this " , " is " ] parsedelimitedstring ( " this | | is " , ' | ' ) returns [ " this | is " ]
