Re: Commons Lang substitution

2015-11-18 Thread Woonsan Ko
Hi Alex, It seems working as it was designed, but probably not for your expectation: - When using "${" and "}", "The ${version} is awesome" would be substituted to "The 1 is awesome", removing the prefix and suffix. - In the same way, when using "$" and a whitespace, "The $version is awesome" woul

Re: Commons Lang substitution

2015-11-18 Thread Alex Soto
Thanks for your help but sadly doesn't work as expected. Look: Map map = new HashMap(); map.put("version", "1"); StrSubstitutor strSubstitutor = new StrSubstitutor(map, "$", ""); strSubstitutor.setVariableSuffixMatcher(StrMatcher.trimMatcher()); System.out.println(

Re: Commons Lang substitution

2015-11-17 Thread Woonsan Ko
I think Jörg is right. You may change the suffix StrMather through #setVariableSuffixMatcher() on a StrSubstitutor. I haven't tried it, but it should be something like this example: final Map valueMap = ...; StrSubstitutor subst = new StrSubstitutor(valuesMap, "$", ""); // NONE_MATCHER for suffi

Re: Commons Lang substitution

2015-11-17 Thread Jörg Schaible
Alex Soto wrote: > Hi, thank you for your answers, Jörg I think that StrMatcher is for > implementing where you want to get information to be replaced on the > string, not for parsing issues. Instead of guessing, I'd rather have a look into the Javadocs of StrSubstitutor. Cheers, Jörg ---

Re: Commons Lang substitution

2015-11-17 Thread Alex Soto
Hi, thank you for your answers, Jörg I think that StrMatcher is for implementing where you want to get information to be replaced on the string, not for parsing issues. El dl., 16 nov. 2015 a les 21:38, Jörg Schaible () va escriure: > Benedikt Ritter wrote: > > > Hello, > > > > 2015-11-14 22:25 G

Re: Commons Lang substitution

2015-11-16 Thread Jörg Schaible
Benedikt Ritter wrote: > Hello, > > 2015-11-14 22:25 GMT+01:00 Anthony Brice : > >> I could be wrong, but I do believe StrSubstitor requires a prefix and >> suffix. I don't think the class will replace variables that aren't in the >> map either, unless you write a custom StrLookup that returns a

Re: Commons Lang substitution

2015-11-16 Thread Benedikt Ritter
Hello, 2015-11-14 22:25 GMT+01:00 Anthony Brice : > I could be wrong, but I do believe StrSubstitor requires a prefix and > suffix. I don't think the class will replace variables that aren't in the > map either, unless you write a custom StrLookup that returns an empty > string for variables not

Re: Commons Lang substitution

2015-11-14 Thread Anthony Brice
I could be wrong, but I do believe StrSubstitor requires a prefix and suffix. I don't think the class will replace variables that aren't in the map either, unless you write a custom StrLookup that returns an empty string for variables not previously defined. On Sat, Nov 14, 2015 at 11:02 AM Alex So

Commons Lang substitution

2015-11-14 Thread Alex Soto
Hi I have two special requirements that I think that Common-Lang StrSubstitutor does not cover, but I would like to know if it is correct or not. The first requirement is that I would like to know if there is a way to make StrSubstitutor works with using simple character as prefix and no suffix. F