This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes Capitalise first letter of each word of a string in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Capitalise first letter of each word of a string in Java" Watch "Capitalise first letter of each word of a string in Java" New topic
Author

Capitalise first letter of each word of a string in Java

javaFirstClass pro
Greenhorn

Joined: Nov 05, 2012
Posts: 1

I have a requirement in which, using Java program have to produce a output like

e.g input string is :

requestresponse

Output String should be:

RequestResponse



I made a text (words.txt it has the list of words with first letter in uppercase) file which contains a list of words then made a java program:



comparing the string with the list of words from the words.txt file and if the word is present in the input string, replace that word from the input string. its working but, I am not sure whether it will work always so, want to know if there is any better and more efficient way?


Cheers!
 
Don't get me started about those stupid light bulbs.
 
subject: Capitalise first letter of each word of a string in Java
 
Similar Threads
Regarding reading a file in a jsp
Reading one line from a text
Replacing a word in a text file
to read lines inside brackets
Error printing out from a read in file.