ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rebhan, Gilbert" <>
Subject RE: Replacing chars in a property
Date Thu, 15 Nov 2007 08:12:06 GMT
-----Original Message-----
From: Nicolai Kamenzky [] 
Sent: Wednesday, November 14, 2007 4:43 PM
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">
    $project.setProperty "foobar", $myproperty.gsub(/\\/,'/')

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

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

Regards, Gilbert

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message