• 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
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

upper/lower case question

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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


 
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Almost all of your code is irrelevant for your question. I would just create a capitalize function:

 
Bartender
Posts: 1952
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic