Nevermind... StringTokenizer is the answer... Sorry for the bother...
>Is there a formal way of processing strings with a pre-determinded
>token (space in this case) ?
four techniques come to mind:
see http://mindprod.com/jgloss/stringtokenizer.html
http://mindprod.com/jgloss/streamtokenizer.html
http://mindprod.com/jgloss/regex.html split method
http://mindprod.com/jgloss/parser.html (if gets more complex)

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
Ravi - 30 Mar 2006 12:07 GMT
If it is very clear that number and corresponding string comes in
alternative place,
then
1.Get the tokesn using Stringtokenizer
2.Iterate in the for loop
3.Using mod operation avoid the alternative position for number
4.Store the remaining string in requred array
I feel this case is optimization rather than reg expression or split
method.
Others correct me If I am wrong.
Oliver Wong - 30 Mar 2006 18:54 GMT
> If it is very clear that number and corresponding string comes in
> alternative place,
[quoted text clipped - 7 lines]
> method.
> Others correct me If I am wrong.
Instead of using modulus to alternate between two processings (one for
number, one for name), you can just read two tokens in a row, e.g.
<pseudoCode>
StringTokenizer st = new StringTokenizer("foo");
while (st.hasMoreTokens()) {
int number = Integer.parseInt(st.nextToken());
String name = st.nextToken();
//Process the numbers and name
}
</pseudoCode>
- Oliver