Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Initial Capital

 
prabhu kandanur
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All
How to contert the string say 'hello how are you' to 'Hello How Are You'
(initial capitals) in java any source available
and where can i get the sample core java source code examples that is useful for application development.

prabhu
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to Java In General (Beginner) forum...
 
Ray Stojonic
Ranch Hand
Posts: 326
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Off the top of my head, I see 2 ways of handling this.
1- recursively break the string into its component words, the end condition for the recursion would be that there are no more spaces in the string. Then return an assemblage of capitalized words.
2- use the String.split method to produce an array of individual words, capitalize each one and reassemble.
There are, I'm sure, other ways of doing this.
There exists on the web more example Java code than you could read in the rest of your days, trying looking for what you need.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic