效率很慢:
public class StringTools { public static String captureName(String name) { name = name.substring(0, 1).toUpperCase() + name.substring(1); return name; } }[title]大神写法[/title] 进行字母的ascii编码前移:
public class StringTools { public static String captureName(String name) { char[] cs=name.toCharArray(); cs[0]-=32; return String.valueOf(cs); } }
文章评论