ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <christopher.d.schu...@comcast.net>
Subject Re: How to Split a String in Ant?
Date Thu, 30 Oct 2003 16:15:11 GMT
Weiqi,

>> My build file will be fed properties like "something_something_15", and 
>> I want a property generated that contains the string "15".  If the last 
>> part after the underscore is not a number, I want the property generated 
>> to have a value "9999".

> you can use the <script> task and write your own routine.  This is what I have
done.  I wonder if there is anything easier tho.

What about setting your properties like this:

my.something.number=15
mv.something=something_something_${my.something.number}

This doesn't solve your problem for "9999", but you can still do this:

<property name="my.something.number" value="9999" />

... and the valud will only be set if it is not already set.

So, instead of parsing the property value, you simply use 
${my.comething.number}.

-chris


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message