Replicating String.split with StringTokenizer

后端 未结 9 1058
心在旅途
心在旅途 2021-02-06 14:03

Encouraged by this, and the fact I have billions of string to parse, I tried to modify my code to accept StringTokenizer instead of String[]

The only t

9条回答
  •  死守一世寂寞
    2021-02-06 14:55

    Rather than StringTokenizer, you could try the StrTokenizer class from Apache Commons Lang, which I quote:

    This class can split a String into many smaller strings. It aims to do a similar job to StringTokenizer, however it offers much more control and flexibility including implementing the ListIterator interface.

    Empty tokens may be removed or returned as null.

    This sounds like what you need, I think?

提交回复
热议问题