tags:

views:

18

answers:

2

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, the thousands are separated from the rest of the digits by a comma, like this:

1,001

1,562

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

A: 

http://ant-contrib.sourceforge.net/tasks/tasks/propertyregex.html

this ant task should do the trick

Aaron Saunders
+1  A: 

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.)

martin clayton
Thanks, that's a very neat way of solving my problem.
Nick