C# method to turn first letter to upper case???

liunx

Guest
Does anybody know a C# method to turn the first character of a string to upper case i.e.

a function turnFirstToUpper such that
turnFirstToUpper("hello") would return: HelloI dont think that is possible, but you can do that through another way

string name = "cipher";
string fstLetter = cipher.Substring(0, 1);
cipher = cipher.Replace(fstLetter, fstLetter.ToUpper());

Response.Write(cipher);
Hope this helps;private string TurnFirstToUpper(string input)
{
string temp = input.Substring(0,1);
return temp.ToUpper() + input.Remove(0,1);
}
 
Back
Top