You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Ja...@rzf.fin-nrw.de on 2003/09/05 12:45:58 UTC

(WAS: RE: [SUBMIT] optional task )

Hmm, attachement didn�t come through ...

Once again:
- sprintf.zip (7kB) containing buildfile and sources (impl and test)


Jan



-----Original Message-----
From: Jan.Materne@rzf.fin-nrw.de [mailto:Jan.Materne@rzf.fin-nrw.de]
Sent: Friday, September 05, 2003 12:39 PM
To: dev@ant.apache.org
Subject: RE: [SUBMIT] optional task <propertyformatter>


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: Jan.Materne@rzf.fin-nrw.de [mailto:Jan.Materne@rzf.fin-nrw.de] 
> Sent: Friday, September 05, 2003 8:09 AM 
> To: dev@ant.apache.org 
> 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:Larry.Shatzer@Spirent.com] 
> > Sent: Friday, September 05, 2003 4:06 AM 
> > To: 'dev@ant.apache.org' 
> > 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 
> > 
> > 
>