CSharp examples for System:String Convert
Convert first character to upper.
using System;/*ww w . j a v a 2s . c o m*/ public class Main{ /// <summary> /// Convert first character to upper. /// </summary> /// <param name="str"></param> /// <returns></returns> public static string FirstCharacterToUpper(this string str) { if (String.IsNullOrEmpty(str) || Char.IsUpper(str, 0)) { return str; } return Char.ToUpperInvariant(str[0]) + str.Substring(1); } }