ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan.Mate...@rzf.fin-nrw.de
Subject AW: upper case first letter of a file
Date Mon, 10 Feb 2003 07:21:21 GMT
For a similar question I wrote a sample:


<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>


It will upcase the first character of a properties value.
	${myprop} = foo
	${Myprop} = Foo
Does it help?


Jan Matèrne



-----Urspr√ľngliche Nachricht-----
Von: Bjoern Eger [mailto:3eger@informatik.uni-hamburg.de]
Gesendet am: Sonntag, 9. Februar 2003 18:56
An: ant-user@jakarta.apache.org
Betreff: upper case first letter of a file


Hi!

I use the style task to generate Java source files from XML input files.

The XML file names start with a lower case letter, so the resulting Java 
source files
also start with a lower case letter. I want to follow the Java code 
conventions, so the
Java files should start with a upper case letter.

Is there a way to capitalize the file names?
Can I maybe use move/mapper task?

Best Regards,

Bjoern


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

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