Library for performing blazing fast string operations in Java.
Super string works in two parts.
- Analysis
- Operation
When you create a super string object, analysis starts. Analysis will vary depending on number of operations super string supports. In case of replace, analysis part identifies all the tokens within the string that need replacing. If some analysis takes too long to run, it might do it lazily.
This is the part where you actually execute a method on an existing super string object. Because all the analysis has already been done on a string, this part is usually very quick. If you wanted super string to replace all labels in a string, this is the part where you do
(new SuperString("Hello, :name:!")).replace(replaceValues);
Make this a field level, static object if you are going to execute replace on it more than once.
final SuperString superString = new SuperString("one two three :afterThree: five :afterFiveIs:");
final Map<String, String> superStringReplaceValues = new HashMap<>();
superStringReplaceValues.put("afterThree", "four");
superStringReplaceValues.put("afterFiveIs", "six");
final String superStringReplacedString = superString.replace(superStringReplaceValues);