You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by ch...@cendec.com on 2001/08/22 02:24:37 UTC

Get Upper Case of a String

Folks,

Anyway that I can get an upper case of a string in Ant?

Thanks in advance

Chris

Re: Get Upper Case of a String

Posted by Erik Hatcher <er...@earthlink.net>.
Ok, this is a bit extreme (but gave me an excuse to toy with the <script>
task some):

  <target name="UpperCaseIt">
    <property name="lowercased" value="abcdefghijk"/>
    <script language="javascript"><![CDATA[
        var proj = UpperCaseIt.getProject();

proj.setProperty("uppercased",proj.getProperty("lowercased").toUpperCase());
    ]]>
    </script>
    <echo message="New Property = ${uppercased}"/>
  </target>

Which output this:

UpperCaseIt:
     [echo] New Property = ABCDEFGHIJK

I'm sure there is a more elegant ways to do this with <script>.   Does
anyone have slick examples of useful things that can be accomplished with
the <script> task?   Is there a handy variable that gives you access to the
current task or project without having to do it by name within the script
task?   I'm somewhat familar with BSF and it looks like you're just handed
targets, references, and properties - but it would be nice if it handed over
"project", "target", and "task" (or perhaps called "this" instead of "task")
as pre-defined accessible objects rather than having to call getters to get
at them.

    Erik


----- Original Message -----
From: <ch...@cendec.com>
To: <an...@jakarta.apache.org>
Sent: Tuesday, August 21, 2001 5:24 PM
Subject: Get Upper Case of a String


> Folks,
>
> Anyway that I can get an upper case of a string in Ant?
>
> Thanks in advance
>
> Chris