Quick hack for <sprintf> (I saw that that is the usual name :-)
That task depends on a library implementing the sprintf functionality.
A little googling gave me three sources:
- http://www.braju.com but "Free for non-commercial use."
- http://sourceforge.net/projects/jformatter but doesn´t compile on my platform
- http://sharkysoft.com/software/java/printf/ but
"Developers: Printf for Java is distributed as fully functional, non-expiring, nag-free, shareware."
So I introduced an interface for abstracting the implementation.
I have chosen the braju implementation for test. Works for simple strings but fails for
numbers and logical values (boolean).
Attached the sources.
Thoughts?
Jan
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Friday, September 05, 2003 8:09 AM
> To: [EMAIL PROTECTED]
> Subject: RE: [SUBMIT] optional task <propertyformatter>
>
>
> First thought on that topic is a kind of printf
> <printf property="" refids="" format=""/>
> where
> property takes the name of the new created property
> refids takes a list of (:,;) separated names of properties
> format takes the format string like in printf
>
> That would be much more powerful than these predefined formats.
>
>
> Jan
>
>
>
> > -----Original Message-----
> > From: Shatzer, Larry [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, September 05, 2003 4:06 AM
> > To: '[EMAIL PROTECTED]'
> > Subject: [SUBMIT] optional task <propertyformatter>
> >
> >
> > Optional Task Proposal <propertyformatter>
> >
> > Bug#22889
> > (http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22889) got me
> > thinking about this. At first I knocked up a quick change to
> > allow uppercase
> > and lowercase with a format attribute for <property>. Then I
> > was thinking, a
> > better place for this is in it's own task. So I decided to
> > write it as it's
> > own task. I used the Jakarta Commons Lang project for the
> > StringUtils and
> > WordUtils, since it offered a few methods that I wanted. Such
> > as swapcase,
> > without re-inventing the wheel.
> >
> > I figure this is best left as a optional task, since it has
> > the requirement
> > on Jakarta Commons Lang. I have not yet created any tests for
> > this, yet, but
> > plan on it. I also plan on fleshing out the documentation
> > more, to include
> > more examples. There are quite a few other methods that
> > StringUtils and
> > WordUtils offer that I would like to include, but will take a
> > bit more time
> > thinking out how I should implement them.
> >
> > Currently this tasks implements the following "formats":
> > "trim", "strip",
> > "deletewhitespace", "chomp", "chop", "uppercase",
> > "lowercase", "swapcase",
> > "capitalize", "uncapitalize", "reverse", "catitalizewords",
> > "capipalizewordsfully", "uncapitalizewords".
> >
> > For a more detailed explanation for what each of these
> > "formats" do, see the
> > documentation, and the Jakarta Commons Lang project for
> > StringUtils and
> > WordUtils.
> >
> > Just a note, I am not a Java programmer normally, so any
> > hints to my code
> > will be appreciated. Since this all wrappers Jakarta Commons
> > Lang stuff, all
> > the heavy lifted is done there. Also, I hope I got the
> > dependency checking
> > right in build.xml.
> >
> > All constructive criticism welcome.
> >
> > -- Larry
> >
> >
>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]