- 1.使用substring()
- 2.使用ASCII对照表
public static String toUpperCaseFirstChar(String source) {
if (null == source || source.isEmpty()) return source;
return source.substring(0, 1).toUpperCase() + source.substring(1);
}
2.使用ASCII对照表
public static String toUpperCaseFirstChar(String source) {
if (null == source || source.isEmpty()) return source;
char[] chs = source.toCharArray();
if (chs[0] > 97 && chs[0] <= 122) chs[0] -= 32;
return new String(chs);
}



