G
Gianni Galore
Assume I read text lines from a file.
Each line consists of blank delimited tokens (strings) similar to e.g.
2011.02.26 Hello Karl ID=42542-;OWE comment455###
At first this line is read into a string variable "myline";
Now I want to assign all the parts to different (string) variables e.g. an array of Strings.
The delimiter should be one or more blanks/whitespaces. The result should be like
part[0]=2011.02.26
part[1]=Hello
part[2]=Karl
part[3]=ID=42542-;OWE
part[4]=comment455###
How can I do this most easily?
Advanced question: Is there a way to DIRECTLY access the let say 3rd token WITHOUT previous split+assign?
Something like:
String thirdtok=gettoken(myline,3);
Gianni
Each line consists of blank delimited tokens (strings) similar to e.g.
2011.02.26 Hello Karl ID=42542-;OWE comment455###
At first this line is read into a string variable "myline";
Now I want to assign all the parts to different (string) variables e.g. an array of Strings.
The delimiter should be one or more blanks/whitespaces. The result should be like
part[0]=2011.02.26
part[1]=Hello
part[2]=Karl
part[3]=ID=42542-;OWE
part[4]=comment455###
How can I do this most easily?
Advanced question: Is there a way to DIRECTLY access the let say 3rd token WITHOUT previous split+assign?
Something like:
String thirdtok=gettoken(myline,3);
Gianni