- #1
camel-man
- 76
- 0
I am trying to capitalize the first letter of every word in a sentence.
Example. "hey what's up" would be "Hey What's Up".
here is my code but nothing is changing the sentence. I thought everything was right.
Example. "hey what's up" would be "Hey What's Up".
here is my code but nothing is changing the sentence. I thought everything was right.
Code:
public static String cap(String aString) {
String[] sentence = aString.split(" ");
String b = "";
for (int i = 0; i < sentence.length; i++) {
Character.toUpperCase(sentence[i].charAt(0));
b += sentence[i] + " ";
}
return b;
}