ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dale Anson <dan...@grafidog.com>
Subject Re: Substring
Date Thu, 03 Nov 2005 14:52:35 GMT
Yes, that is correct.  It is mentioned in the task documentation [1].

Dale

[1] http://antelope.tigris.org/nonav/docs/manual/bk03ch13.html

Rebhan, Gilbert wrote:

>Hi,
>
>Dale, in your example below =
>
><property name="Prop1" value="/my/folder/"/>
><property name="Prop2" value="/my other folder/"/>
>
>Property Prop2 is already set, so if you're
>able to write =
>
><stringutil string="${Prop2}" property="Prop2">
>
>does it mean, that the StringUtil task has a builtin
>propertycopy feature, as properties are immutable
>normally ?
>
>Regards, Gilbert
>
>-----Original Message-----
>From: Dale Anson [mailto:danson@grafidog.com] 
>Sent: Wednesday, November 02, 2005 4:43 PM
>To: Ant Users List
>Subject: Re: Substring
>
>You can also use the StringUtil task from Antelope. Then you could do 
>something like:
>
><property name="Prop1" value="/my/folder/"/>
><property name="Prop2" value="/my other folder/"/>
>
><stringutil string="${Prop2}" property="Prop2">
>    <substring beginindex="1"/>
></stringutil>
><echo>${Prop1}${Prop2}</echo>
>
>will print out
>
>/my/folder/my other folder/
>
>
>Or 
>
><property name="Prop1" value="/my/folder/"/>
><property name="Prop2" value="/my other folder/"/>
><property name="Prop3" value="${Prop1}${Prop2}"/>
>
><stringutil string="${Prop3}" property="Prop3">
>   <replace regex="//" replacement="/"/>
></stringutil>
>
><echo>${Prop3}</echo>
>
>will print out the same.
>
>See http://antelope.tigris.org.
>
>
>Dale
>
>
>
>Rebhan, Gilbert wrote:
>
>  
>
>>Hi,
>>
>>the only alternative i know of would be using
>>the PropertyRegex task from antcontrib.
>>
>>My suggestion is the most easiest.
>>
>>Would be nice if you could just write it like =
>>
>><property name="bla" value="${Prop1}${Prop2}">
>>           <filterchain>
>>               <replacestring from="//" to="/" />
>>           </filterchain>
>>       </property>
>>
>>in core ant, but the property task doesn't support
>>the nested filterchain element.
>>
>>With PropertyRegex you have a syntax like =
>>
>><propertyregex property="correctedPath"
>>             input="${Prop1}${Prop2}"
>>             regexp="your regex goes here"
>>             select="... "
>>             casesensitive="false" />
>>
>>or
>>
>><propertyregex property="correctedPath"
>>             input="${Prop1}${Prop2}"
>>             regexp="your regex goes here"
>>             replace="..."
>>             casesensitive="false" />
>>
>>You don't need to write a file here, but you have
>>find a working regular expression.
>>
>>
>>Gilbert
>>
>>-----Original Message-----
>>From: Remo Liechti [mailto:remo.liechti@swisslog.com] 
>>Sent: Wednesday, November 02, 2005 9:37 AM
>>To: Ant Users List
>>Subject: RE: Substring
>>
>>Hi Gil
>>Is there no easy way to do it? :/ It's a bit overhead to write files
>>    
>>
>for
>  
>
>>this, isn't it ;)
>>If there is no other possibility I'll do it this way...
>>
>>Thanks anyway,
>>Remo 
>>
>>
>>
>> 
>>
>>    
>>
>>>-----Original Message-----
>>>From: Rebhan, Gilbert [mailto:Gilbert.Rebhan@huk-coburg.de] 
>>>Sent: Mittwoch, 2. November 2005 09:31
>>>To: Ant Users List
>>>Subject: RE: Substring
>>>
>>>
>>>Hi,
>>>
>>>echo ${Prop1}${Prop2} to yourfile.txt
>>>then use a filterchain when loading
>>>the contents of that file in a new property =
>>>
>>><loadfile property="bla" srcfile="C:/yourfile.txt">
>>>           <filterchain>
>>>               <replacestring from="//" to="/" />
>>>           </filterchain>
>>>       </loadfile>
>>>
>>>
>>>
>>><echo>${bla}</echo>
>>>
>>>gives you >>> /my/folder/my other folder/
>>>
>>>Gilbert
>>>
>>>
>>>-----Original Message-----
>>>From: Remo Liechti [mailto:remo.liechti@swisslog.com]
>>>Sent: Wednesday, November 02, 2005 8:46 AM
>>>To: Ant Users List
>>>Subject: Substring
>>>
>>>Good Morning
>>>Is it possible to to some string operations on a property?
>>>
>>>Example:
>>>Prop1: "/my/folder/"
>>>Prop2: "/my other folder/"
>>>
>>>Now I log:
>>>File moved to: ${Prop1}${Prop2}
>>>
>>>This logs:
>>>"/my/folder//my other folder/"
>>>
>>>The double slash is not nice... But I need all the slashes in 
>>>Prop1 and Prop2... So I need to do a substring action on one 
>>>of the properties.
>>>I took a look at the documentation of ANT but did not found 
>>>some string operations or stuff like this. I think there is 
>>>such things, may be I looked at the wrong place. If so, 
>>>please tell me where I have to look next time ;)
>>>
>>>Thank you
>>>
>>>Remo
>>>
>>>____________________________________________________________
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For 
>>>additional commands, e-mail: user-help@ant.apache.org
>>>
>>>
>>>____________________________________________________________
>>>This message has been checked for all known viruses by Messagelabs.
>>>
>>>   
>>>
>>>      
>>>
>>---------------------------------------------------------------------
>>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
>>
>> 
>>
>>    
>>
>
>---------------------------------------------------------------------
>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
>
>  
>

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


Mime
View raw message