Java Mailing List Archive

http://www.ant-tasks.com/

Apache Ant Archive

» Ant Users List
» Ant Developers List
Convert Value to lower case

Convert Value to lower case

2007-06-26       - By Rebhan, Gilbert
Reply:     1     2  


Hi,

-----Original Message-----
From: Hardy Grueneis [mailto:Hardy.Grueneis@(protected)]
Sent: Tuesday, June 26, 2007 6:41 AM
To: user@(protected)
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@(protected)
For additional commands, e-mail: user-help@(protected)


©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.