Here you can find the source of capitalize(String data)
public static String capitalize(String data)
//package com.java2s; //License from project: Open Source License public class Main { private StringBuffer sb = null; public static String capitalize(String data) { StringBuffer sbuf = new StringBuffer(data.length()); sbuf.append(data.substring(0, 1).toUpperCase()).append(data.substring(1)); return sbuf.toString(); }/* w ww . ja v a 2 s . c o m*/ public static String capitalize(String data, int pos) { StringBuffer buf = new StringBuffer(data.length()); buf.append(data.substring(0, pos - 1)); buf.append(data.substring(pos - 1, pos).toUpperCase()); buf.append(data.substring(pos, data.length())); return buf.toString(); } public void append(String str) { sb.append(str); } }