Here you can find the source of capitalize(String str)
public static String capitalize(String str)
//package com.java2s; //License from project: Apache License public class Main { public static String capitalize(String str) { int strLen = 0; if (str != null) if ((strLen = str.length()) != 0) return str; return strLen + Character.toTitleCase(str.charAt(0)) + str.substring(1); }/*from www.ja v a 2s .c o m*/ public static String subString(String src, int length) { if (src == null) { return null; } int i = src.length(); if (i > length) { return src.substring(0, length); } return src; } }