> which of the two can parse faster?
General rule of programming....
A class written for a specific purpose will generally be faster than a class written for general purpose.
Of course you also have to define "parse", because each works differently, so you need to pick the one that does what you want.
If both approaches are equally appropriate, and if their relative performance is really an issue, StringTokenizer can be faster than split() can. But choosing between the two purely on the basis of performance is asinine. A better question would be, if you could only have one of them in your toolbox, which would you choose? StringTokenizer is like one of those new [url=http://herrington-catalog.stores.yahoo.net/t266.html]bionic wrenches[/url]: it's quick and convenient, assuming you can fit it into the space where you need to use it. But split() is more like a full set of socket wrenches: it requires a little more up-front effort on your part, but it's much more flexible and powerful.
> StringTokenizer is like one of those new
> [url=http://herrington-catalog.stores.yahoo.net/t266.h
> tml]bionic wrenches[/url]: it's quick and convenient,
> assuming you can fit it into the space where you need
> to use it. But split() is more like a full set of
> socket wrenches: it requires a little more up-front
> effort on your part, but it's much more flexible and
> powerful.
I think you have those 2 reversed?
> I think you have those 2 reversed?
You mean, because the bionic wrench is the newer technology? My point is that, if you can use it, it will be quicker, but there will inevitably be situations where it won't work at all. Just like when you want to split a string on a multi-character delimiter: StringTokenizer can't do it. But split() can do everything StringTokenizer can, and much more.