To Initial Case - CSharp System

CSharp examples for System:String Case

Description

To Initial Case

Demo Code


using System.Text.RegularExpressions;
using System.Linq;
using System.Globalization;

public class Main{
        public static string ToInitialCase(this string text)
        {/* w w w.  j  av a  2  s .  com*/
            return text.Substring(0, 1).ToTitleCase() + text.Substring(1).ToLower();
        }
        public static string ToTitleCase(this string text)
        {
            return CultureInfo.CurrentCulture.TextInfo.ToTitleCase(text);
        }
}

Related Tutorials