Java Mailing List Archive

http://www.ant-tasks.com/

Apache Ant Archive

» Ant Users List
» Ant Developers List
AW: upper case first letter of a file

AW: upper case first letter of a file

2003-02-10       - By Jan.Materne@(protected)

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@(protected)]
Gesendet am: Sonntag, 9. Februar 2003 18:56
An: ant-user@(protected)
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@(protected)
For additional commands, e-mail: ant-user-help@(protected)

©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.