Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

First character of a string to lowercase

843789Dec 22 2009 — edited Dec 22 2009
I want to rewrite the first character of a string to lowercase and I strongly suspect that there's a better/easier way of doing it than this rather elaborate way I figured (being a real beginner):
char [] nameInChars = token[x].toCharArray();
char lower = Character.toLowerCase(nameInChars[0]);
String nameEdit = token[x].replace(token[x].charAt(0), ' ');
String nameTrimmed = nameEdit.trim();
String nameLowerCase = new StringBuilder().append(lower).append(nameTrimmed).toString();
Suggestions would be much appreciated!

Edited by: Igor_Pavlove on Dec 22, 2009 5:45 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 19 2010
Added on Dec 22 2009
5 comments
470 views