ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wolfgang haefelinger <whaefelin...@gmail.com>
Subject Re: make a string lowercase
Date Tue, 11 Jan 2011 10:28:34 GMT
> The simplest is to use Antelope tasks:  http://antelope.tigris.org/nonav/docs/manual/bk03ch13.html

Rather simple is also

<property name="newVar" value="${  myVar.tolower }" />

which you would get by enabling Flaka's  [1] property helper.

Also checkout [2] for many other 'String' properties and functions
working on (String) objects. For example, you could also utilize
Java's Formatter [3] capabilities for additional conversion mechanics,
like shown here for creating the 'uppercase' property:

<property name="newVar" value="${ format('%S', myVar)  }" />

An upcoming version of Flaka will allow you to define your very own functions.


[1] http://code.google.com/p/flaka
[2] http://flaka.googlecode.com/files/flaka.pdf
[3] http://download.oracle.com/javase/1.5.0/docs/api/java/util/Formatter.html


On Mon, Jan 10, 2011 at 9:19 PM, Shawn Castrianni
<Shawn.Castrianni@halliburton.com> wrote:
> The simplest is to use Antelope tasks:  http://antelope.tigris.org/nonav/docs/manual/bk03ch13.html
>
> That URL shows using the lowercase task in the very first example.
>
> ---
> Shawn Castrianni
>
>
> -----Original Message-----
> From: Gilbert Rebhan [mailto:gilreb@maksimo.de]
> Sent: Monday, January 10, 2011 2:11 PM
> To: Ant Users List
> Subject: Re: make a string lowercase
>
> -------- 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
>
> ----------------------------------------------------------------------
> This e-mail, including any attached files, may contain confidential and privileged information
for the sole use of the intended recipient.  Any review, use, distribution, or disclosure
by others is strictly prohibited.  If you are not the intended recipient (or authorized to
receive information for the intended recipient), please contact the sender by reply e-mail
and delete all copies of this message.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>



-- 
Wolfgang Häfelinger
häfelinger IT - Applied Software Architecture
http://www.haefelinger.it
+31 648 27 61 59

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


Mime
View raw message