Grokbase Groups Ant user June 2007
FAQ

[Ant-user] Convert Value to lower case

Hardy Grueneis
Jun 26, 2007 at 4:41 am
Hi,

I want to convert the value of a property into lower cases.
How can I do this with Ant 1.6.2?

Example:
<property name="demo" value="Demo"/>
${demo} == demo

Thanks for any help.

Hardy






--------------------------
Metris GmbH - Industriestr. 5 - D-78112 St. Georgen
Registergericht: Villingen-Schwenningen, HRB 2448 Sitz St. Georgen
Geschaeftsfuehrer: Hans-Peter Hess, Herbert Stieglitz, Markus Gueckel

Diese E-Mail und die angehaengten Dokumente koennen vertrauliche und/oder rechtlich besonders geschuetzte Informationen enthalten. Die Informationen sind nur zur Kenntnisnahme durch oben genannte Empfaenger bestimmt. Eine Weitergabe an Dritte ist nicht zulaessig. Diese E-Mail stellt kein Angebot oder Annahme eines Angebotes dar. Metris haftet nicht dafuer, dass die E-Mail bzw. der Anhang virusfrei ist. Bitte benachrichtigen Sie den Sender, wenn Sie diese E-Mail versehentlich erhalten haben und loeschen Sie die E-Mail. Jede Offenlegung, Kopieren, Verteilen oder Nutzung einer versehentlichen erhaltenen E-Mail oder deren Inhalte ist untersagt.

This electronic transmission, and any documents attached to it, may contain confidential and/or legally privileged information. The information is intended only for the use by the recipient named above and should not be copied or disclosed to anyone other than the addressee. The contents are not to be regarded as a contractual offer or acceptance. Metris is not liable for any viruses that may be contained in this electronic transmission or any attachments. If you have received this message in error, please notify the sender and delete it promptly. Any disclosure, copying, distribution, or use of this message and its contents received in error is strictly prohibited.
reply

Search Discussions

1 response

  • Rebhan, Gilbert at Jun 26, 2007 at 6:06 am
    Hi,

    -----Original Message-----
    From: Hardy Grueneis
    Sent: Tuesday, June 26, 2007 6:41 AM
    To: user@ant.apache.org
    Subject: Convert Value to lower case

    /*
    I want to convert the value of a property into lower cases.
    How can I do this with Ant 1.6.2?
    */

    i would go via <script> task and i.e JRuby =

    <project name="bla" default="main" basedir=".">

    <property name="testprop" value="DEMO"/>

    <target name="depends">
    <script language="ruby">
    <![CDATA[
    $project.setProperty "testprop" , $testprop.downcase
    ]]>
    </script>
    </target>

    <target name="main" depends="depends">
    <echo>
    $${testprop} == ${testprop}
    </echo>
    </target>
    </project>

    gives you =

    [echo] ${testprop} == demo


    But beware, this does not follow the standard Ant convention of
    property immutability

    There are also possibillities with addon tasks
    like antelope <stringutils> or antcontrib (see property tasks)
    if you don't like using a scripting language like jruby,groovy,
    javascript, beanshell, jython ....

    http://antelope.tigris.org/
    http://ant-contrib.sourceforge.net/

    that's non standard Ant too;
    this tasks does not follow the standard Ant convention of property
    immutability either;


    Regards, Gilbert


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

Related Discussions

Discussion Navigation
viewthread | post

2 users in discussion

Rebhan, Gilbert: 1 post Hardy Grueneis: 1 post