ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan.Mate...@rzf.fin-nrw.de
Subject AW: First char Uppercase
Date Thu, 28 Nov 2002 07:11:56 GMT
I did a little try ... and it works (for me):

<project name="myProject" basedir="." default="foo">
    <property name="myprop" value="foo" />
    <target name="foo">
        <!-- Using Javascript functions to convert the string -->
        <script language="javascript"> <![CDATA[

            // getting the value
            lowercaseValue = myProject.getProperty("myprop");

            // the first character
            ch = lowercaseValue.substring(0,1);

            // the rest of the value
            rest = lowercaseValue.substring(1);

            // convert first character to uppercase
            up = ch.toUpperCase();

            // concatenate the uppercase with the rest
            uppercaseValue = up + rest;

            // store the result in a new property
            myProject.setProperty("Myprop",uppercaseValue);

        ]]> </script>

        <!-- Display the values -->
        <echo>myprop=${myprop}</echo>
        <echo>Myprop=${Myprop}</echo>

    </target>
</project>


Jan ...   Matèrne :-)

> -----Urspr√ľngliche Nachricht-----
> Von: jan casteels [mailto:jan_casteels@msn.com]
> Gesendet am: Donnerstag, 28. November 2002 04:13
> An: ant-dev@jakarta.apache.org
> Betreff: First char Uppercase
> 
> 
> Hi,
> 
> I need to change the first char of a property to uppercase.
> 
> foo needs to be changed to Foo where foo was stored in a property.
> 
> How can I do this?
> 
> 
> Jan
> 
> 
> 
> 
> 
> _________________________________________________________________
> MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. 
> http://join.msn.com/?page=features/virus
> 
> 
> --
> To unsubscribe, e-mail:   
> <mailto:ant-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: 
> <mailto:ant-dev-help@jakarta.apache.org>
> 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message