Clone value stringTokenizer java

I have stringTokenizer installed and I want to have a copy of it for another process. Is there any way to do this? My code is:

StringTokenizer itr = new StringTokenizer(theBigString);
itr.nextToken();
// My goal is to get a new StringTokenizer after the first token
//StringTokenizer itrCopy = new StringTokenizer(itr.toString());

Is there any way to do this?

+4
source share
1 answer

This may not answer your question exactly, but, quoting the StringTokenizer Docs ,

StringTokenizer is an inherited class that is preserved for compatibility, although its use is not recommended in new code. It is recommended that anyone looking for this functionality use the split String method or instead of the java.util.regex package.

, , . , , StringTokenizer, , , split? StringTokenizer - returnDelims true ( ), split.

StringTokenizer, . StringTokenizer Serializable, Serializable, void. , - , , , , XML/JSON. . , .

+2

Source: https://habr.com/ru/post/1658045/


All Articles