HuyPV
Sunday, February 20, 2011
private String[] split(String original) {
Vector nodes = new Vector();
String separator = ":";
System.out.println("split start...................");
// Parse nodes into vector
int index = original.indexOf(separator);
while(index>=0) {
nodes.addElement( original.substring(0, index) );
original = original.substring(index+separator.length());
index = original.indexOf(separator);
}
// Get the last node
nodes.addElement( original );
// Create splitted string array
String[] result = new String[ nodes.size() ];
if( nodes.size()>0 ) {
for(int loop=0; loop
{
result[loop] = (String)nodes.elementAt(loop);
System.out.println(result[loop]);
}
}
return result;
}
Title:
J2ME - Split String
Description:
private String[] split(String original) { Vector nodes = new Vector(); String separator = ":"; System.out.println("split s...
...
Rating:
4