Am Looping through a sentence splitting it to capitalize.But its hard to build it back after getting the individual words.
String str = "Not the answer you're looking for.";
StringBuilder stringBuilder = new StringBuilder();
String oneWord =" ";
for (String word : str.toLowerCase().split(" ")){
char firstLetter = word.substring(0,1).toUpperCase().charAt(0);
oneWord = firstLetter + word.substring(1);
System.out.println(stringBuilder.append(oneWord + " "));
}
}
I expect to get only one fully built String "Not The Answer You're Looking For."