View Code? Open in Web Editor
NEW
Token Replacer is a simple and small Java Library that helps replacing tokens in strings. You can replace the tokens with static values or create values "on-the-fly" by calling a generator. You can even pass arguments to the generator which makes it pretty powerful.
Home Page: www.marcel-sauer.de
License: Other
tokenreplacer's Issues
When processing a string with pound signs (#), all the pound signs get replaced.
e.g.
String[] args = new String[]{"x","y"};
new Toky().register(args).substitute("first one {0} second one {1} and so on")
or something similar
sometimes you have a string with tokens that are not known until runtime.
e.g.
some text with a ${token} and ${anotherOne} and ${anotherOne}.
as a developer i want to be able to register a callback which gets called for every token that is found.
so the callback would be called for
callback.replaceToken("token")
callback.replaceToken("anotherOne")
callback.replaceToken("anotherOne")
and so on
:)
e.g.
replacer.register(new Token("blank").replacedBy("");
results in IllegalStateException. must be possible to provide empty strings.