private String[] split(String _text, String _separator) {
Vector nodes = new Vector();
// Parse nodes into vector
int index = _text.indexOf(_separator);
while (index >= 0) {
nodes.addElement(_text.substring(0, index));
_text = _text.substring(index + _separator.length());
index = _text.indexOf(_separator);
}
// Get the last node
nodes.addElement(_text);
// Create splitted string array
String[] result = new String[nodes.size()];
if (nodes.size() > 0) {
for (int loop = 0; loop < nodes.size(); loop++) {
result[loop] = (String) nodes.elementAt(loop);
System.out.println(result[loop]);
}
}
return result;
}
No comments:
Post a Comment