• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

upper/lower case question

 
choubix alex
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Almost all of your code is irrelevant for your question. I would just create a capitalize function:

 
Jelle Klap
Bartender
Posts: 1951
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or, if you don't mind the dependency, you could use the StringUtils class of the Apache Commons library.
Tried and true.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic