I am currently using split()
to scan through a file where each line has number of strings delimited by \'~\'
. I read somewhere that Scanner>
You don't actually need a regex here, because you are splitting on a fixed string. Apache StringUtils
split does splitting on plain strings.
For high volume splits, where the splitting is the bottleneck, rather than say file IO, I've found this to be up to 10 times faster than String.split()
. However, I did not test it against a compiled regex.
Guava also has a splitter, implemented in a more OO way, but I found it was significantly slower than StringUtils for high volume splits.