ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeffrey E Care <ca...@us.ibm.com>
Subject Re: splitting a string
Date Tue, 11 Oct 2005 00:09:18 GMT
I think AntContrib's <propertyregex> task could do this.

-- 
Jeffrey E. Care (carej@us.ibm.com)
WebSphere v7 Release Engineer
WebSphere Build Tooling Lead (Project Mantis)




"Lasher, James L" <jim.lasher@hp.com> 
10/10/2005 07:43 PM
Please respond to
"Ant Users List"


To
"Ant Users List" <user@ant.apache.org>
cc

Subject
splitting a string






Hello all,

I'm hoping someone here could help me with an idea on how to take a
property and "split" it into two (additional) properties.  My specific
situation is that I have a property that has a value of
[0-9][0-9].[0-9][0-9].[0-9][0-9][0-9].  I would like to split this so
that I end up with one new property whose value is the beginning of the
original property string ([0-9][0-9].[0-9][0-9]) and the second whose
value would be the last set of [0-9][0-9][0-9]. 

I currently have the original property defined in a file
(/tmp/refverprops) which looks like:

ReferenceVersionMinor=02.10.555

I've figured out a way to get the second property value which in my
example will be ReferenceVersionMinor by doing the following:

       <loadproperties srcfile="/tmp/refverprops">
       <filterchain>
         <linecontains>
           <contains value="ReferenceVersionMinor"/>
         </linecontains>
         <tokenfilter>
           <replaceregex pattern="[0-9][0-9]\.[0-9][0-9]\." replace=""/>
         </tokenfilter>
       </filterchain>

This will give me a property name/value of ReferenceVersionMinor/555
I can't figure out though how to do something similar to get the first
property value of:  02.10 (without a trailing dot after 10).  I could
whip up a custom task to do this for me, but would prefer to use what's
already available in Ant, if I can find what that might be.  Can anyone
help?

-jim-

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



Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message