Here you can find the source of toTitleCase(String input)
public static String toTitleCase(String input)
//package com.java2s; //License from project: Apache License public class Main { public static String toTitleCase(String input) { StringBuilder titleCase = new StringBuilder(); boolean nextTitleCase = true; for (char c : input.toCharArray()) { if (Character.isSpaceChar(c)) { nextTitleCase = true;/*from ww w. j a va 2 s .c om*/ } else if (nextTitleCase) { c = Character.toTitleCase(c); nextTitleCase = false; } titleCase.append(c); } return titleCase.toString(); } }