Here you can find the source of capitalizeAll(String text)
public static String capitalizeAll(String text)
//package com.java2s; //License from project: Open Source License public class Main { public static String capitalizeAll(String text) { if (text == null || text.length() == 0) return "null"; text = text.toLowerCase();/* w w w. j a va2s . c o m*/ String result = ""; for (int i = 0; i < text.length(); i++) { if (i == 0 || i > 1 && text.charAt(i - 1) == ' ') result += Character.toString(text.charAt(i)).toUpperCase(); else result += text.charAt(i); } return result; } }