-----Original Message-----
From: Nicolai Kamenzky [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, November 14, 2007 4:43 PM
To: [email protected]
Subject: Replacing chars in a property

/*
Hi folks!

I have a property which contains a path "C:\Documents and Settings 
\..." and I have to convert it to this format "c/Documents\ and\  
Settings/...". Thus I have to replace "\" with "/" and so on.

How do I do this? I can access my property with ${myProperty} and  
want to get another property with the replaced chars.
*/

<project name="bla" default="main">

  <property name="myproperty" value="C:\Documents and Settings\"/>

  <target name="depends">
   <script language="ruby">
   <![CDATA[
    $project.setProperty "foobar", $myproperty.gsub(/\\/,'/')
   ]]>
   </script>
  </target>

<target name="main" depends="depends">
 <echo>$${foobar} == ${foobar}</echo>
</target>
</project>


main:
     [echo] ${foobar} == C:/Documents and Settings/
BUILD SUCCESSFUL
Total time: 1 second


Regards, Gilbert

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to