//--------------------------------------------------------------------------------- // SPLIT function // // takes a string (or single char) to use as the delimiter // and splits the "str" on that delimiter returning a vector // similar to Perl's split function // // returns a Vector with the invidiual pieces // //--------------------------------------------------------------------------------- public static Vector split(String spltr, String str) { Vector v = new Vector(); boolean ok = true; int indx1 = 0; int indx2 = 0; str = str.trim(); while(ok) { indx2 = str.indexOf(spltr, indx1); if (indx2 != -1) { v.addElement(str.substring(indx1, indx2)); indx1 = indx2 + 1; } else { ok = false; } } v.addElement(str.substring(indx1, str.length())); return v; }