ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicolai Kamenzky <kamen...@inf.fu-berlin.de>
Subject Re: Replacing chars in a property
Date Fri, 16 Nov 2007 10:40:14 GMT
Thanks a lot David!

I succeeded by doing this:
<loadfile property="modbasedir" srcFile="xyz">
	<filterchain>
		<expandproperties/>
		<replacestring from="\" to="/"/>
		<replacestring from=":" to=""/>
		<replacestring from=" " to="\ "/>
	</filterchain>
</loadfile>

My original path is inside the property "basedir" while the file "xyz"
contains the string "${basedir}". Thus I get my original path by using
"<expandproperties/>".
(My modified path is inside the property "modbasedir".)

Is there a way not to be in need of the file "xyz"? AFAIK all commands
that support a filterchain are working on files rather than just  
properties.

Cheers,
Nicolai

On 16.11.2007, at 05:45, David Weintraub wrote:

> A little tired right now to test it, but you could use a filter in a
> copy. See these pages:
>
> <http://ant.apache.org/manual/CoreTypes/filterchain.html>
> <http://ant.apache.org/manual/CoreTypes/ 
> filterchain.html#replacestring>
>
> On Nov 15, 2007 1:32 PM, Nicolai Kamenzky <kamenzky@inf.fu- 
> berlin.de> wrote:
>> 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.
>>
>> Cheers,
>> Nicolai
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>>
>
>
>
> -- 
> --
> David Weintraub
> qazwart@gmail.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message