Java string, you need to rewrite the first letter, the idea of the internet is basically the same, that is, the first letter interception, converted into uppercase and then string on the back, similar to the following code//first Letter Capital
public static string Capturename (string name) {
Name = name.substring (0, 1). toUpperCase () + name.substring (1);
return name;
}
Converts the string name to the capital letter. But this efficiency is not high, I have seen a cow before the method of writing the core code, is this
Capitalize first letter
public static string Capturename (string name) {
Name = name.substring (0, 1). toUpperCase () + name.substring (1);
return name;
Char[] Cs=name.tochararray ();
cs[0]-=32;
Return string.valueof (CS);
}
Heart is heartfelt admiration, that is, the ASCII encoding of letters forward, but this article on the Internet can not find, so in this record for review.