Here you can find the source of toUpperCaseFirst(String str)
public static String toUpperCaseFirst(String str)
//package com.java2s; //License from project: Apache License public class Main { public static String toUpperCaseFirst(String str) { if (str == null) { return null; } else if (str.length() == 0) { return str; } else {// ww w . j av a 2 s. c om String pre = String.valueOf(str.charAt(0)); return str.replaceFirst(pre, pre.toUpperCase()); } } public static String toUpperCase(String instr) { return instr == null ? instr : instr.toUpperCase(); } }