user1051892
user1051892

Reputation: 3432

Ant add trailing zeros

Hello i have a variable in Ant: ${env.BUILD_NUMBER}
And i wan't that this variable is always 6 characters long.
If not Ant should add trailing zeros.

1 should be 100000
39 should be 390000
5656 should be 565600

How is this possible using a Ant build script?

Thanks!

Upvotes: 2

Views: 749

Answers (1)

Christopher Peisert
Christopher Peisert

Reputation: 24124

There is a solution using the PropertyFile Ant task described here: Re: Zero-Padding an Int Ant Property

You may also want to checkout the propertyregex task from Ant Contrib. See Replacing characters in Ant property

Upvotes: 1

Related Questions