Is this Code Useful for you ?

Is this Posible

Is this Posible
Rack your brain 4 possibilities....

Wednesday, July 28, 2010

Split Function

public static String[] split(String s, char separator) {
Vector v = new Vector();
for (int ini = 0, end = 0; ini < s.length(); ini = end + 1) {
end = s.indexOf(separator, ini);
if (end == -1) {
end = s.length();
}

String st = s.substring(ini, end).trim();
if (st.length() > 0) {
v.addElement(st);
} else {
v.addElement("null");
}
}

String temp[] = new String[v.size()];
v.copyInto(temp);
return temp;
}

2 comments: