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: property.toLowerCase()
Date Wed, 04 Aug 2004 06:29:53 GMT
Not directly with Ant. But via its Java API (String.toLowerCase(),
String.toUpperCase()).


Jan



<?xml version="1.0" encoding="ISO-8859-1"?>
<project>

    <property name="prop" value="MixedContent"/>

    <scriptdef name="lc" language="javascript">
        <attribute name="property"/>
        <attribute name="value"/>
        project.setNewProperty(attributes.get("property"),
attributes.get("value").toLowerCase());
    </scriptdef>

    <scriptdef name="uc" language="javascript">
        <attribute name="property"/>
        <attribute name="value"/>
        project.setNewProperty(attributes.get("property"),
attributes.get("value").toUpperCase());
    </scriptdef>

    <lc property="lcProp" value="${prop}"/>
    <uc property="ucProp" value="${prop}"/>

    <echo>
      prop   = ${prop}
      lcProp = ${lcProp}
      ucProp = ${ucProp}
    </echo>

</project>


Buildfile: build.xml
     [echo]
     [echo]       prop   = MixedContent
     [echo]       lcProp = mixedcontent
     [echo]       ucProp = MIXEDCONTENT
     [echo]

BUILD SUCCESSFUL




> -----Urspr√ľngliche Nachricht-----
> Von: Eduardo Andrés Alfonso Sierra [mailto:ed_alfon@spymac.com]
> Gesendet am: Dienstag, 3. August 2004 21:42
> An: Ant Users List
> Betreff: property.toLowerCase()
> 
> Hi
> 
> Does anybody knows if it's possible to change the case of the 
> value of a
> property or a variable (ant-contrib)??
> 
> I want to place the value of a property in a file, but I need 
> it to be in
> lower case. Is it possible ??  Can I make something like
> ${myProp}.toLowerCase() ????   (Just a silly example).
> 
> Thanks in advance !!
> 
> Eduardo
> 
> 
> 
> 
> ---------------------------------------------------------------------
> 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