ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lasher, James L" <jim.las...@hp.com>
Subject splitting a string
Date Mon, 10 Oct 2005 23:43:18 GMT
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
View raw message