This question already has an answer here:
- Scanner vs. StringTokenizer vs. String.Split 10 answers
I've been using String[] split(String)
of String
class to split any string for some given delimiter, and it worked fine.
However, now it is expected to re-factor the same logic with StringTokenizer
. But what are the differences and benifits of using one over the other.
Also, I feel that String[]
returned by split()
in a single call is much efficient option than using the objects of the class StringTokenizer
.
Here is a link answering (from my point of view) the question: http://lavnish.blogspot.com/2008/05/stringsplit-vs-stringtokenizer.html