Hello Ryan,

under "Optional Tasks" in the manual there is something called <propertyfile/>.

it can format numbers, so this might be what you want.

since its output is a file, you will need to load the generated property file 
after having used <propertyfile/>

so 

<propertyfile file="some.generated.properties">
  <entry  key="formated.int" type="int" value="${buildNum}" operation="=" 
pattern="0000"/>
</propertyfile>
<property file="some.generated.properties"/>
<delete file="some.generated.properties"/>

should do the job.

Regards,

Antoine
-------- Original-Nachricht --------
Datum: Thu, 24 Aug 2006 14:39:32 -0500
Von: Ryan Sawatzky <[EMAIL PROTECTED]>
An: user@ant.apache.org
Betreff: Zero-Padding an Int Ant Property

> Hello all,
> 
> I have an Ant property file that contains a project build number 
> property.  This build number is incremented every time the project is 
> compiled.  I distribute my application as a versioned JAR file through 
> Web Start, and I want to append the build number to the name of my JAR 
> file.  For example, if my build number was 51, I want my JAR file to be 
> named "myjar__V1.0051.jar".
> 
> My ant command looks like this...
>  <jar destfile="${dist.jar.dir}/myjar__V1.${buildNum}.jar" 
> basedir="${build.classes.dir}" ................ />
> 
> However, this generates a JAR file named "myjar__V1.15".  Is there 
> anyway I can have ant zero-pad the build number property out to 4 
> digits?  Or is there another way to do this?
> 
> Thanks for any ideas,
> -Ryan
> -- 
> / Ryan Sawatzky
> Software Engineer
> Computer Projects Of Illinois, Inc.
> 6416 South Cass Ave.
> Westmont, IL 60559
> Pho: 630-968-0244 Ex 47.
> Fax: 630-968-0481
> /
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to