commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Colebourne <scolebou...@btopenworld.com>
Subject Re: What tool can I use to substitute marked expressions in a string?
Date Thu, 01 Mar 2007 00:46:05 GMT
Karr, David wrote:
> I know that there are several related tools in this area, but I'm not
> sure from a superficial look exactly which one I need.
> 
> I just need to have a string with occurrences of substrings like
> "${foo}", and I need to be able to replace that with a value specified
> at run time.  I need to do this directly from Java, and I nee to be able
> to specify both the variables (like "foo") and what values will be
> substituted for them.
> 
> I thought I would do this with JEXL, but that seems to just take a
> string like "foo" and not "... Stuff ... ${foo} ...".  I imagine I could
> do this semi-manually, by searching for "${.*}" and processing the
> contents.  If there's no packaged way to do this already, I'll go down
> that path.

Try commons-lang StrSubstitutor.

Stephen

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message