Here you can find the source of toUppercaseFirstLetter(String str)
public static String toUppercaseFirstLetter(String str)
//package com.java2s; //License from project: Open Source License public class Main { public static String toUppercaseFirstLetter(String str) { if (str == null || str.length() == 0) { return str; }/*from w w w .j a va 2s . c om*/ char firstLetter = str.charAt(0); if (Character.isLowerCase(firstLetter)) { if (str.length() > 1) { return "" + Character.toUpperCase(firstLetter) + str.substring(1); } else { return "" + Character.toUpperCase(firstLetter); } } else { return str; } } }