Reputation: 779
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).
Upvotes: 5
Views: 1898
Reputation: 3392
Figured ###0 would have worked, but it didn't. Since the project is already making extensive use of ant-contrib, it wasn't difficult to add the regex solution Aaron suggested.
<propertyregex property="build" input="${build}" regexp="," replace="" global="true" override="true"/>
Upvotes: 0
Reputation: 78105
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.)
Upvotes: 12