ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Jan.Mate...@rzf.fin-nrw.de>
Subject AW: extracting part of a property.
Date Mon, 08 Aug 2005 12:29:56 GMT
I had a snippet in my snippet-lib ...

<?xml version="1.0" encoding="ISO-8859-1"?>
<project>
    <property name="configs" value="FooName1:FooType1,FooName2:FooType2" />

    <scriptdef name="split" language="javascript">
         <attribute name="value"/>
         <attribute name="sep"/>
         <attribute name="prefix"/>
         <![CDATA[
             values = attributes.get("value").split(attributes.get("sep"));
             for(i=0; i<values.length; i++) {
                 project.setNewProperty(attributes.get("prefix")+i, values[i]);
             }
         ]]>
    </scriptdef>

    <split value="${configs}" sep="," prefix="sc."/>
    <echoproperties prefix="sc"/>

</project>



Maybe that helps.


Jan 

>-----Urspr√ľngliche Nachricht-----
>Von: Krist van Besien [mailto:krist.vanbesien@gmail.com] 
>Gesendet: Montag, 8. August 2005 14:26
>An: user@ant.apache.org
>Betreff: extracting part of a property.
>
>Hello,
>
>I am trying to figure out if I could get ant to do some string 
>manipulation.
>Suppose I have a property with value: "foo_0.01 and I want to 
>split this on the _ character  and put "foo" and "0.01"
>each in a different property to use further down in my ant script.
>
>How would I do this?
>
>Krist
>
>
>
>--
>krist.vanbesien@gmail.com
>Solothurn, Switzerland
>
>---------------------------------------------------------------------
>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