Felice Vittoria wrote:

Hello all,

I was wondering if there's a way I could use the script task to implement nant 0.85's string::replace function. Is it possible to do this in nant 0.84? If so, how?



possible yes but not very pretty. Heres one way to do it:

<target name="replace">
   <script language="c#">

<code><![CDATA[

public static void ScriptMain(Project project) { project.Properties["string.out"] = project.Properties["string.in"].Replace( project.Properties["string.oldvalue"], project.Properties["string.newvalue" );
}
]]></code>
</script>


</target>

<target name="somthingelse" >
...
   <property name="string.in" value="My long string" />
   <property name="string.oldvalue" value="long" />
   <property name="string.newvalue" value="not so long" />
   <call target="replace" />

   <!-- now string.out = My not so long string -->
</target>

Ian

Thanks,
Felice


-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_idP47&alloc_id808&op=click
_______________________________________________
Nant-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-users




--
Ian MacLean, Developer, ActiveState, a division of Sophos
http://www.ActiveState.com




-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
_______________________________________________
Nant-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to