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
String s="hi dude i want apple"; s = s.replaceAll("\\s+"," "); String[] split = s.split(" "); s=""; for (int i = 0; i < split.length; i++) { split[i]=Character.toUpperCase(split[i].charAt(0))+split[i].substring(1); s+=split[i]+" "; System.out.println(split[i]); } System.out.println(s);