| Author |
upper/lower case question
|
choubix alex
Greenhorn
Joined: Dec 25, 2009
Posts: 22
|
|
hello,
I've understood how to display decimals and change strings to upper/lower case (so many online resources on Java!)
I was wondering what should be best in the following code where I convert a string to:
1st character: upper string, subsequent characters, lower case. (line 25, first block of code)
the code is quite lengthy...
instead of calling "myaccount.GetAnyVariableNameHere" in the out.println(), shall I create a variable and call it ?
if so: should the name be the same as in the setter/getter or different?
thanks!
and
|
 |
Wouter Oet
Saloon Keeper
Joined: Oct 25, 2008
Posts: 2700
|
|
Almost all of your code is irrelevant for your question. I would just create a capitalize function:
|
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
|
 |
Jelle Klap
Bartender
Joined: Mar 10, 2008
Posts: 1402
|
|
Or, if you don't mind the dependency, you could use the StringUtils class of the Apache Commons library.
Tried and true.
|
Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
|
 |
 |
|
|
subject: upper/lower case question
|
|
|