Here you can find the source of capitalize(String s)
public static String capitalize(String s)
//package com.java2s; //License from project: LGPL public class Main { public static String capitalize(String s) { String[] split = s.split("_"); String result = ""; for (int i = 0; i < split.length; i++) { if (i != 0) { result += " " + split[i].substring(0, 1).toUpperCase() + split[i].substring(1); } else { result += split[i].substring(0, 1).toUpperCase() + split[i].substring(1); }/* ww w .j ava 2 s . co m*/ } return result; } }