ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rebhan, Gilbert" <Gilbert.Reb...@huk-coburg.de>
Subject RE: Convert Value to lower case
Date Tue, 26 Jun 2007 06:05:44 GMT
 
Hi,

-----Original Message-----
From: Hardy Grueneis [mailto:Hardy.Grueneis@metris.de] 
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


Mime
View raw message