I dont know any core tasks. Maybe there are external tasks for that.
Alternatively you could implement your own.

Jan


<project>

    <property name="list" 
value="one,two,three,four,five,six,seven,eight,nine,ten"/>
    <property name="ignore" value="two,four,six,eight,ten"/>
    
    <scriptdef name="revert" language="javascript">
        <attribute name="list"/>
        <attribute name="property"/>
        <![CDATA[
            listParts = attributes.get("list").split(",");
            newValue = "";
            for(i=listParts.length-1; i>=0; i--) {
                newValue += "," + listParts[i];
            }
            if (newValue.length > 0) {
                newValue = newValue.substring(1);
            }
            project.setNewProperty(attributes.get("property"), newValue);
        ]]>
    </scriptdef>

    <scriptdef name="filter" language="javascript">
        <attribute name="list"/>
        <attribute name="excludes"/>
        <attribute name="property"/>
        <![CDATA[
            listParts = attributes.get("list").split(",");
            exclParts = attributes.get("excludes").split(",");
            newValue = "";
            for(i=0; i<listParts.length; i++) {
                add = true;
                for(j=0; j<exclParts.length && add; j++) {
                    add = !listParts[i].equals(exclParts[j]);
                }
                if (add) {
                    newValue += "," + listParts[i];
                }
            }
            if (newValue.length > 0) {
                newValue = newValue.substring(1);
            }
            project.setNewProperty(attributes.get("property"), newValue);
        ]]>
    </scriptdef>
    
    
    <filter property="filtered" list="${list}" excludes="${ignore}" />
    <revert property="reverted" list="${filtered}"/>
    <echo>
       The original list   : ${list}
       filtered list       : ${filtered}
       reverted + filtered : ${reverted}
    </echo>

</project>

 

>-----Ursprüngliche Nachricht-----
>Von: Raagu [mailto:rknilekani2...@gmail.com] 
>Gesendet: Mittwoch, 5. August 2009 11:46
>An: user@ant.apache.org
>Betreff: Reversing a list
>
>
>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-unsubscr...@ant.apache.org
>For additional commands, e-mail: user-h...@ant.apache.org
>
>

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

Reply via email to