You could use StringTokenizer but the preferred method these days is to use the String.split() method. This uses regular expressions to split the string and returns an array of the parts.
For example:
Michael Ku
Ranch Hand
Joined: Apr 20, 2002
Posts: 510
posted
0
Thanks Tony, I was unaware of this improvement in the language
thomas colding
Ranch Hand
Joined: Mar 23, 2007
Posts: 59
posted
0
Exactly what I would like to do. but I need to Put each value in a new Variable as following af after I have split it.
the mention Split-object will put all the values in a array . How do I extract the each value and put them in to a string. [ August 18, 2007: Message edited by: thomas colding ]
Garrett Rowe
Ranch Hand
Joined: Jan 17, 2006
Posts: 1295
posted
0
Why would you prefer not to reference the results by the array index? Anyway if you must you could do something like this:
But seriously, I don't see what is gained by doing this. [ August 18, 2007: Message edited by: Garrett Rowe ]
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
thomas colding
Ranch Hand
Joined: Mar 23, 2007
Posts: 59
posted
0
Lake off Java-knowledge, after a little Weekend study I found out that it is possible to ref. drirect to a Array. And I can not use Split-method since my Java-version is 1.4.1 Thanks for the Guidens everybody, You have to Crawl before you can Walk, I am just in the first Phase:-)
[ August 20, 2007: Message edited by: thomas colding ] [ August 20, 2007: Message edited by: thomas colding ]
Joanne Neal
Rancher
Joined: Aug 05, 2005
Posts: 3011
9
posted
0
Originally posted by thomas colding: And I can not use Split-method since my Java-version is 1.4.1
String.split() was introduced in 1.4, so you can use it.