ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilbert Rebhan <gil...@maksimo.de>
Subject Re: make a string lowercase
Date Mon, 10 Jan 2011 20:11:25 GMT
-------- Original Message  --------
Subject: Re: make a string lowercase
From: halfsetgelly <sjb@legacysd.com>
To: user@ant.apache.org
Date: 07.01.2011 14:19

> You could use  http://ant.apache.org/manual/Tasks/pathconvert.html
> <pathconvert>  and a 
> http://ant.apache.org/manual/Types/mapper.html#script-mapper scriptmapper 
> 
> 
>  <property name="mixed" value="Foo_Baa"/>
> 
>   <pathconvert property="converted">
>    <path path="${mixed}"/>
>    <chainedmapper>
>     <flattenmapper/>
>     <scriptmapper language="javascript">
>      self.addMappedName(source.toLowerCase());
>     </scriptmapper>
>     </chainedmapper>
>   </pathconvert>
> 
>   <echo>${converted}</echo>

or use flaka [1], example script with some possibilities =

<project xmlns:fl="antlib:it.haefelinger.flaka">

 <property name="mixed" value="Foo_Baa" />
 <echo>$${mixed} = ${mixed}</echo>
 <!-- with <fl:install-property-handler/>
 <echo>${mixed} tolower => #{mixed.tolower}</echo>
 -->
 <!-- echo tolower -->
 <fl:echo>${mixed} tolower => #{mixed.tolower}</fl:echo>
 <!-- overwrite existing property -->
 <fl:let>mixed ::= mixed.tolower</fl:let>
 <echo>$${mixed} overwritten = ${mixed}</echo>
 <!-- create new property -->
 <fl:let>mixed_tolower := mixed.tolower</fl:let>
 <echo>$${mixed_tolower} = ${mixed_tolower}</echo>

</project>

output =

[echo] ${mixed} = Foo_Baa
[fl:echo] Foo_Baa tolower => foo_baa
[echo] ${mixed} overwritten = foo_baa
[echo] ${mixed_tolower} = foo_baa

[1] http://code.google.com/p/flaka/
when downloading the jar with inlined dependencies,
no further libraries are needed =
[2] http://code.google.com/p/flaka/downloads/list
    (ant-flaka-1.02.00.jar)


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