ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Weintraub <qazw...@gmail.com>
Subject Re: Reversing a list
Date Wed, 05 Aug 2009 14:42:05 GMT
Well, if you don't mind using the AntContrib package, you could do this
using the AntContrib's <for> ,  <if> ,  and the <variable> tasks to build
the string. I haven't tested it, but it would look something like this:

<for
    list="${list}"
    delimiter=","
    param="word">
    <sequential>
        <if>
            <isset property="newlist"/>
            <then>
               <variable name="newlist"
                  value="@{word},${newlist}"/>
            </then>
            <else>
               <variable name="newlist"
                   value="@{word}"/>
            </else>
       </if>
     </sequential>
</for>
<echo>Old List="${list}" New List="${newlist}"</echo>

I tried playing around with regular expressions, but I couldn't get one to
do reversing.

On Wed, Aug 5, 2009 at 5:45 AM, Raagu <rknilekani2005@gmail.com> wrote:

>
> Hello People
>
> I have a written a ant script which has a variable say "list" which
> contains
> list of names say name1,name2,ant,forum,nabble     . All r comma
> separated..
>
> I want to reverse this list such dat , after reversing "list" should give
> me
> nabble,forum,ant,name2,name1..
>
> And also Is there any option to discard  some of the values from list..??
> Please reply
> Thanks in advance
> --
> View this message in context:
> http://www.nabble.com/Reversing-a-list-tp24823814p24823814.html
> Sent from the Ant - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>


-- 
David Weintraub
qazwart@gmail.com

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