M
Marc E
All,
Been a looong time since i've done any string parsing in java. I seem to
remember there being a braindead simple way of turning a string like this:
100,1,1;2598,2,3;25467,1,3
into an array of arrays delimited first on the semicolon and then on the
comma.
Currently, i'm just stringTokenizing it on the semicolon and then doing
next() calls.
So...
StrTokenizer = new StrTokenizer("100,1,1;2598,2,3;25467,1,3",";");
List list = tokenizer.asList()
iterate over list
StrTokenizer newTokenizer = new StrTokenizer(list.next(),",");
List newlist = newTokenizer.asList();
thisVal = newlist.next();
someOtherVal = newlist.next();
and so forth.
it's just damn ugly, so i'm wondering what the best/cleanest way to do this
in java is.
thanks all.
Marc
Been a looong time since i've done any string parsing in java. I seem to
remember there being a braindead simple way of turning a string like this:
100,1,1;2598,2,3;25467,1,3
into an array of arrays delimited first on the semicolon and then on the
comma.
Currently, i'm just stringTokenizing it on the semicolon and then doing
next() calls.
So...
StrTokenizer = new StrTokenizer("100,1,1;2598,2,3;25467,1,3",";");
List list = tokenizer.asList()
iterate over list
StrTokenizer newTokenizer = new StrTokenizer(list.next(),",");
List newlist = newTokenizer.asList();
thisVal = newlist.next();
someOtherVal = newlist.next();
and so forth.
it's just damn ugly, so i'm wondering what the best/cleanest way to do this
in java is.
thanks all.
Marc