You probably need to parse position into an int:
<echo>${int::parse(position) - 3}</echo>
Bob
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Steve
Kapinos
Sent: Saturday, September 13, 2008 11:23 PM
To: [email protected]
Subject: Re: [NAnt-users] can you nest functions? problems with data
types
I can simplify this even more..
I have this
<property name="position"
value="${string::index-of(deploySetupLogContents,'ResultCode=') + 11}"/>
<echo>${position}</echo>
This outputs 135 for the echo
But when I try
<echo>${position - 3}</echo>
It considers position a string, not an int. Without the outside ${ }
its not an expression. How do I reference the property 'position' here
to subtract 3 from it?
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Steve
Kapinos
Sent: Saturday, September 13, 2008 11:13 PM
To: [email protected]
Subject: [NAnt-users] can you nest functions? problems with data types
Ok, I'm trying to do some simple expressions to manipulate some values,
but I'm not having luck nesting expressions. Specifically, I can not
figure out how to use a function as a argument to another function.
This means I have to use incremental steps and assign the value to a
property, then reference that property in a later step rather then doing
it in a single step. Is it possible to use a function as an arugument
to another function?
Something like..
Value=${stringsubstring(property1, property2, string::length(property3)
- property4}
Any combination I try to nest an expression inside another fails.
I'm also having a problem with specifying properties properly inside an
expression
Here's what I'm trying to do..
I have a string in a property. I need to get the index location of a
substring, add to that number, get the overall length of the string, do
a subtraction of those two numbers, and then use these two numbers to
get a substring. The pseudo code would be something like this
Position = string::Pindex-of(string, value) + 11
targetlength = string::length(string) - $position
result = string::substring(string, position, targetlength)
My code currently is
<target name="test">
<loadfile file="setup.log" property="deploySetupLogContents" />
<property name="position"
value="${string::index-of(deploySetupLogContents,'ResultCode=') + 11}"/>
<property name="length"
value="${string::get-length(deploySetupLogContents) - position}"/>
<property name="deploySetupResultCode"
value="${string::substring(deploySetupLogContents, position, length)}"/>
<echo>Result Code is ${deploySetupResultCode}</echo>
</target>
But the above does not work. It complains that in line 4, it can't do
the subtraction between an 'int' and 'string'. Position is not a
string.. it's a property which is holding an init from line 3. I can't
specify it as ${position}.. so how can I reference the value I need
here? I need the entire thing inside an ${ } so its evaluated as an
expression and not just saved as a string.
-Steve
------------------------------------------------------------------------
-
This SF.Net email is sponsored by the Moblin Your Move Developer's
challenge
Build the coolest Linux based applications with Moblin SDK & win great
prizes
Grand prize is a trip for two to an Open Source event anywhere in the
world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
NAnt-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nant-users
------------------------------------------------------------------------
-
This SF.Net email is sponsored by the Moblin Your Move Developer's
challenge
Build the coolest Linux based applications with Moblin SDK & win great
prizes
Grand prize is a trip for two to an Open Source event anywhere in the
world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
NAnt-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nant-users
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
NAnt-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nant-users