== First char of a String to uppercase ==
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   joey_corleon
Posted On:   Monday, October 7, 2002 08:46 AM

Hi,


How do I do in JAVA to convert only the first character of a String to its uppercase?

Something with not too much of overhead if possible.


Joey

Re: == First char of a String to uppercase ==

Posted By:   Anonymous  
Posted On:   Monday, October 7, 2002 10:07 AM

String str = "test";

String strUpper = new StringBuffer(str.length()).append(Character.toUpperCase(str.charAt(0))).append(str.substring(1)).toString();


This solution creates some overhead, but this always the case when manipulation strings...
About | Sitemap | Contact