Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ant propertyfile task: how can I set an integer with no thousand separators?

Tags:

ant

I have a property defined in one of my property files:

<entry key="build" default="0" type="int" operation="+" value="1" />

I read this property using:

<replacefilter token="@build@" property="build_num" />

Once this number gets bigger than 999, thousand separator commas start appearing, like this:

1,001
1,562

Is there a way to get rid of those commas? (I use build to generate a file name, and don't really want to see any commas in there).

like image 246
Nikita Avatar asked Oct 18 '10 21:10

Nikita


1 Answers

You can prevent thousand separators from being used by adding a pattern to the entry:

<entry key="build" default="0" type="int" operation="+" value="1" pattern="0" />

Note that you'll probably need to manually remove the commas one-time before running this - else your build numbers will reset, with the comma and subsequent digits being discarded. (So 1,325 -> 2 and 4,111 -> 5 and so on.)

like image 122
martin clayton Avatar answered Oct 07 '22 14:10

martin clayton