Here you can find the source of toTitleCase(String s)
public static String toTitleCase(String s)
//package com.java2s; public class Main { public static String toTitleCase(String s) { s = s.toLowerCase();//from w ww . j ava2 s.c om int strl = s.length(); char[] holder = new char[strl]; boolean titleActive = true; int i = 0; while (i < strl) { char nextC = s.charAt(i); if (titleActive == true || i == 0) { nextC = Character.toTitleCase(nextC); titleActive = false; } if (Character.isWhitespace(nextC) == true) titleActive = true; holder[i] = nextC; i++; } return new String(holder); } public static String toLowerCase(String s) { return s.toLowerCase(); } }