Capitalizing each word in a sentence with loop
public class Main { public static void main(String[] a) { String sentence = "this is a test"; String tmp = ""; String[] words = sentence.split(" "); for (int i = 0; i < words.length; i++) { tmp += words[i].substring(0, 1).toUpperCase(); tmp += words[i].substring(1).toLowerCase(); tmp += " "; } System.out.println(tmp.trim()); } }
1. | Capitalizing each word in a sentence with recursive function | ||
2. | Rules Demo | ||
3. | Keys Demo | ||
4. | Break Iterator Demo | ||
5. | Character Demo |