There are many ways to Title Case in java.
But how do you prevent some of the common abbreviations from being converted. For Example;
System.out.println(makeProper("JAMES A SWEET");
System.out.println(makeProper("123 MAIN ST SW");
James A Sweet
123 Main St Sw
SW should remain uppercase as it is an abbreviation to South West.
You need some sort of dictionary that contains words that should not be capitalized. You could use a
HashSet
for that. Something along these lines: