Snippet Fire

Beta
 Log In    |   Sign Up

.NET : Capitalize The First Letter of a String in C#

Added on Dec-09-2011 by admin
For .NET

Tags : string

Use the ToUpper method of the char object in combination with the string's index to capitalize the first letter. For the remainder of the string simply use the Substring method to return the string beyond the first character.

DOWNLOAD

string inputStr = "america";
string capitalizedStr = char.ToUpper(inputStr[0]) + inputStr.Substring(1);

    

Report Snippet

blog comments powered by Disqus