Yeah, they wouldn't let me keep it :(
The method is in com.generationjava.util.Interpolator
[http://www.generationjava.com/projects/GenJavaCore.shtml], or, as you
probably won't want more dependencies, [and as GJ uses Namespace not Map]
it ought to just be:
static public String interpolate(String text, Map namespace) {
Iterator keys = namespace.keySet().iterator();
while(keys.hasNext()) {
String key = keys.next().toString();
Object obj = namespace.get(key);
String value = obj.toString();
text = StringUtils.replace(text, "${"+key+"}", value);
if(key.indexOf(" ") == -1) {
text = StringUtils.replace(text, "$"+key, value);
}
}
return text;
}
Hope that helps,
Hen
On Thu, 16 Jan 2003 [EMAIL PROTECTED] wrote:
> This method was removed for 1.0 due to its specific nature.
>
> Sorry.
>
> Stephen
>
> > from: Simon Moore <[EMAIL PROTECTED]>
> > date: Thu, 16 Jan 2003 11:10:59
> > to: [EMAIL PROTECTED]
> > subject: Re: Where has commons lang Strings.interpolate(String text, Map map)
>gone?
> >
> > > I've been cleaning up some alod code dependant on commons-lang 0.1-dev to
> > > depend on commons-lang 1.0 but I'm missing the
> > > Strings.interpolate(String text, Map map) in StringUtils???
> > >
> > > Does anyone know where it went?
> > >
> > > Regards,
> > >
> > > Saimon
> > >
> > >
> >
> > --
> > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> >
>
>
> --
> To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>