commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Heger <>
Subject Re: [StrSubstitutor] Can StrSubstitutor be used without a prefix or suffix?
Date Mon, 10 Sep 2007 19:53:19 GMT
James Watkin wrote:
> I'd like to use org.apache.commons.lang.text.StrSubstitutor without a 
> suffix requirement for the replacement targets, but it doesn't seem to 
> support that. Is that correct?
> Although the doc for org.apache.commons.lang.text.StrSubstitutor 
> disallows a null prefix or suffix in the constructor, it doesn't mention 
> the empty string. I tried the empty string for the prefix and suffix but 
> that didn't work.
> - Jim

By looking at the code, yes, it seems that a suffix is required.

How do the variables look like you are dealing with? Perhaps it is an 
option to provide your own implementation of the StrMatcher class [1], 
which is internally used for detecting prefixes and suffixes 
(StrSubstitutor has methods that take such matchers instead of a prefix 
and a suffix as string). This should not be too complicated.



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message