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; if ("".equals(str)) return str; String first = String.valueOf(str.charAt(0)); str.replaceFirst(first, first.toUpperCase()); return str; }// w ww. j a v a2 s.co m public static boolean equals(String str1, String str2) { if (str1 == null && str2 == null) return true; if (str1 != null && str1.equals(str2)) return true; return false; } public static String toUpperCase(String str) { return str == null ? str : str.toUpperCase(); } }