Is there an easy way to use Splash Guavas to split a string and save separators without using regular expressions?
Sort of
String string = "1+2-3*40";
Splitter splitter = Splitter.on(CharMatcher.DIGIT.negate()).retainDelimiters();
This gives
[1, +, 2, -, 3, *, 40]
I know about Splitter.onpattern (), but it will require a regular expression from me (however, I am trying to avoid this).
source
share