File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes upper/lower case question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "upper/lower case question" Watch "upper/lower case question" New topic

upper/lower case question

choubix alex

Joined: Dec 25, 2009
Posts: 22

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?



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

Joined: Mar 10, 2008
Posts: 1951

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.
I agree. Here's the link:
subject: upper/lower case question
It's not a secret anymore!