Home > Back-end >  Java capitalize the first letter
Java capitalize the first letter

Time:10-16

Java string, capitalize the first letter is required to rewrite, online everyone's way of thinking, is the first letter to intercept, converted to uppercase and then later on, similar to the following code
//capitalize the first letter
Public static String captureName (String name) {
Name=name. The substring (0, 1). The toUpperCase () + name. The substring (1);
Return the name;

}

//the string name letter headed by transformation, but the efficiency is not high, before have I seen a cow person method of write the core code, so
//capitalize the first letter
Public static String captureName (String name) {
Char [] cs=name. ToCharArray ();
Cs [0] -=32;
Return a String. The valueOf (cs);
}

CodePudding user response:

Nature is almost

CodePudding user response:

Do not have what distinction, you said that the great god of writing is transformed according to corresponding asc character code

CodePudding user response:

refer to the second floor KeepSayingNo response:
do not have what distinction, you said that the great god of writing is to character transformed corresponding asc code

It seems that is I make a fuss
  • Related