Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Beginning Java
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Beginning Java
String - can you improve my poor code?
Marco Vanoli
Ranch Hand
Posts: 99
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Getting
string
"value" a want a new one "setValue"..
String s = x.getMethodName(); <- x example return "value" String ss = x.getMethodName().substring(1); Character ch; ch = s.charAt(0);<-have to upperCase firstletter String g = Character.toString(ch); String myMethod = "set" + g.toUpperCase() + ss;<-then add set to method name for finela have "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
Posts: 3742
16
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
String myMethod = "set" + s.substring(0, 1).toUpperCase() + s.substring(1);
Joanne
Don't get me started about those stupid
light bulbs
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Prompt for file name
Passing a String by reference
Form input type=hidden - is it possible to set values dynamically
ternary operator
Numeric and Integer value? Same?
More...