Hi, Niranjan....
 
The way you coded it will concatenate value1 and value2.  You';; need the int::parse() function to get the numeric "value" of the "string".
 
Here's soemthing I ended up doing when I was formatting the build number.  Setting length.1 involved subtracting one property from another.

  <property name="index"         value="${string::last-index-of(build.number, '.')}"/>
  <property name="index.1"        value="${int::parse(index) + 1}"/>
 
  <property name="length"         value="${string::get-length(build.number)}"/>
  <property name="length.1"        value="${int::parse(length) - int::parse(index) - 1}"/>
  <property name="version.1"        value="${string::substring(build.number, 0, int::parse(index))}"/>
  <property name="version.2"        value="${string::substring(build.number, int::parse(index.1),int::parse(length.1))}"/>
  <property name="msi.productversion"     value="${version.1}${version.2}"/>
 
Rod


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ramya Niranjan
Sent: Monday, February 20, 2006 9:35 PM
To: nant-users@lists.sourceforge.net
Subject: [NAnt-users] Adding variables.

Hello,
 
I wish to add 2 variables using NAnt. any ideas?
 
Currently this is what i am doing:
 

<

property name="value1" value="1"/>

<property name="value2" value="2"/>

<property name="value3" value="${(value1)+(value2)}"/>

<echo message="${value3}"/>

 

This is returning 12. I knwo this is happening because the values value1 and value2 are being concatenated instead of added. Any ideas how to convert these strings into integers so that i could perform the + operation on them?


Thanks and Regards,

Niranjan

Reply via email to