The code is just a concept right now, that is why I have written the code to print for upper case letters. My question is how do I get the program to only print this statement once, instead of printing for each character? (e.g "Up","Up","Up" etc)

Is there a function built into Java that capitalizes the first character of each word in a String, and does not affect the others?

Examples:

jon skeet -> Jon Skeet

miles o'Brien -> Miles O'Brien (B remains capital, this rules out Title Case)

old mcdonald -> Old Mcdonald*

*(Old McDonald would be find too, but I don't expect it to be THAT smart.)

A quick look at the Java String Documentation reveals only toUpperCase() and toLowerCase(), which of course do not provide the desired behavior. Naturally, Google results are dominated by those two functions. It seems like a wheel that must have been invented already, so it couldn't hurt to ask so I can use it in the future.

Code is supposed to take the input for the size of the array and a set of characters and output them as uppercase. My problem is that when I input a sentence like "i love chocolate" its returning ILOVECHOCOLATE. Is the issue how I am grabbing the input? Or am I losing the spaces else where?

I have the following code that is supposed to capitalise the first letter of each word. However the first character, arr[i][0] is not getting updated. I ended up doing arr[i] = arr[i][0].toUpperCase() + arr[i].substr(1) which worked but I do not understand why the below does not work.