Mega Code Archive

 
Categories / C# / Data Types
 

To First Upper Case

using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Utility.Text {   public static class StringExtendcs   {     public static string ToFirstUpper( this string str )     {       if ( str != null && str.Length > 0 )       {         StringBuilder strBuilder = new StringBuilder( str );         strBuilder[0] = Char.ToUpper( strBuilder[0] );         return strBuilder.ToString();       }       else       {         return str;       }     }   } }