Is it possible to build a regexp for use with Javas Pattern.split(..)
method to reproduce the StringTokenizer("...", "...", true)
behaveiour?
So that the input is split to an alternating sequence of the predefined token characters and any abitrary strings running between them.
The JRE reference states for StringTokenizer
it should be considered deprecated and String.split(..)
could be used instead way. So it is considered possible there.
The reason I want to use split
is that regular expressions are often highly optimized. The StringTokenizer
for example is quite slow on the Android Platforms VM, while regex patterns are executed by optimized native code there it seems.