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 Soto  wrote:

> 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. For example:
>
> "This is my $name and I am happy"
>
> I have tried  by using new StrSubstitutor(map, "$", "") and
> StrSubstitutor(map, "$", " ") but no luck.
>
> I have tried with commons-lang and commons-lang3.
>
> The second one is that I would like to know if there is a way to force that
> in case of no substitution found, the var is replaced with white space
> instead of untouch it.
>
> Thank you very much for your attention.
>
> Alex.
>


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. For example:

"This is my $name and I am happy"

I have tried  by using new StrSubstitutor(map, "$", "") and
StrSubstitutor(map, "$", " ") but no luck.

I have tried with commons-lang and commons-lang3.

The second one is that I would like to know if there is a way to force that
in case of no substitution found, the var is replaced with white space
instead of untouch it.

Thank you very much for your attention.

Alex.