I am trying to get two string firstName and lastName which is fully in uppercase and tring to convert all the characters except the first one in lowercase and concatenate the resultant strings.
firstname="TOM"; lastName="HARRIS";
Output is : Tom Harris
I achieved it by doing:
String name =
firstName.substring(0,1).toUpperCase()
+ firstName.substring(1).toLowerCase()
+ " "
+ lastName.substring(0,1).toUpperCase()
+ lastName.substring(1).toLowerCase();
but is there any other way of doing ? a more efficient way ?
String
constructions. – hmjd Aug 16 '12 at 7:51