wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes String - can you improve my poor code? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "String - can you improve my poor code?" Watch "String - can you improve my poor code?" New topic
Author

String - can you improve my poor code?

Marco Vanoli
Ranch Hand

Joined: Jan 12, 2005
Posts: 99
Getting string "value" a want a new one "setValue"..



This work but i don' t like it, somone have a best way to get the same result?


bye, <br />Marco
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3720
    
  16
String myMethod = "set" + s.substring(0, 1).toUpperCase() + s.substring(1);


Joanne
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: String - can you improve my poor code?