You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Aaron Freeman <aa...@sendthisfile.com> on 2006/11/08 17:58:24 UTC
String handling TagLib
It's hard to believe there is not a commons String handling taglib where all
of the functions available to a String are encapsulated in a .TLD file like:
<function>
<name>replaceAll</name>
<function-class>com.layerz.util.StringUtil</function-class>
<function-signature>String replaceAll( java.lang.String,
java.lang.String, java.lang.String )</function-signature>
</function>
So that you can use them in JSTL like:
<c:set var="variable" value="${string:replaceAll(param.source, param.regex,
param.replacement}"/>
Maybe this exists and I am overlooking it?
Aaron Freeman
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
RE: String handling TagLib
Posted by Aaron Freeman <aa...@sendthisfile.com>.
Ah, I knew it was too common to not exist!
Thanks!
Aaron Freeman
> -----Original Message-----
> From: mfncooper@gmail.com [mailto:mfncooper@gmail.com] On
> Behalf Of Martin Cooper
> Sent: Wednesday, November 08, 2006 11:06 AM
> To: Jakarta Commons Users List
> Subject: Re: String handling TagLib
>
> On 11/8/06, Aaron Freeman <aa...@sendthisfile.com> wrote:
> >
> > It's hard to believe there is not a commons String handling taglib
>
>
> You're looking in the wrong place. Jakarta Commons doesn't do
> tag libraries; Jakarta Taglibs does:
>
> http://jakarta.apache.org/taglibs/
>
> --
> Martin Cooper
>
>
> where all
> > of the functions available to a String are encapsulated in
> a .TLD file
> > like:
> >
> > <function>
> > <name>replaceAll</name>
> > <function-class>com.layerz.util.StringUtil</function-class>
> > <function-signature>String replaceAll( java.lang.String,
> > java.lang.String, java.lang.String )</function-signature>
> > </function>
> >
> > So that you can use them in JSTL like:
> >
> > <c:set var="variable" value="${string:replaceAll(param.source,
> > param.regex , param.replacement}"/>
> >
> > Maybe this exists and I am overlooking it?
> >
> > Aaron Freeman
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> commons-user-help@jakarta.apache.org
> >
> >
>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
Re: String handling TagLib
Posted by Martin Cooper <ma...@apache.org>.
On 11/8/06, Aaron Freeman <aa...@sendthisfile.com> wrote:
>
> It's hard to believe there is not a commons String handling taglib
You're looking in the wrong place. Jakarta Commons doesn't do tag libraries;
Jakarta Taglibs does:
http://jakarta.apache.org/taglibs/
--
Martin Cooper
where all
> of the functions available to a String are encapsulated in a .TLD file
> like:
>
> <function>
> <name>replaceAll</name>
> <function-class>com.layerz.util.StringUtil</function-class>
> <function-signature>String replaceAll( java.lang.String,
> java.lang.String, java.lang.String )</function-signature>
> </function>
>
> So that you can use them in JSTL like:
>
> <c:set var="variable" value="${string:replaceAll(param.source, param.regex
> ,
> param.replacement}"/>
>
> Maybe this exists and I am overlooking it?
>
> Aaron Freeman
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>
Re: String handling TagLib
Posted by ri...@violetshivers.com.
There are a lot of these types of things available in the fmt and fn taglibs:
http://java.sun.com/products/jsp/jstl/1.1/docs/tlddocs/fmt/tld-summary.html
http://java.sun.com/products/jsp/jstl/1.1/docs/tlddocs/fn/tld-summary.html
I've used these to do all kinds of string manipulation, although sometimes
you have to be clever about how you use them to get fairly advanced
functionality. But for your example, you can just use:
${fn:replace(text, "-", "/")}
HTH...
Aaron Freeman wrote:
> It's hard to believe there is not a commons String handling taglib where
> all
> of the functions available to a String are encapsulated in a .TLD file
> like:
>
> <function>
> <name>replaceAll</name>
> <function-class>com.layerz.util.StringUtil</function-class>
> <function-signature>String replaceAll( java.lang.String,
> java.lang.String, java.lang.String )</function-signature>
> </function>
>
> So that you can use them in JSTL like:
>
> <c:set var="variable" value="${string:replaceAll(param.source,
> param.regex,
> param.replacement}"/>
>
> Maybe this exists and I am overlooking it?
>
> Aaron Freeman
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>
--
Rick Herrick
rick@violetshivers.com
Proud member of the reality-based community
Never try to discourage thinking for you are sure to succeed.--Bertrand
Russell
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org