Converts the string to Title Case (a.k.a., Proper Case). - CSharp System

CSharp examples for System:String Convert

Description

Converts the string to Title Case (a.k.a., Proper Case).

Demo Code

// BDHero is free software: you can redistribute it and/or modify
using System.Threading;
using System.Text.RegularExpressions;
using System.Net;
using System.Collections.Generic;
using System;/* w  ww.  java  2  s . c o m*/

public class Main{
        /// <summary>
        /// Converts the string to Title Case (a.k.a., Proper Case).
        /// </summary>
        public static String ToTitle(this String str)
        {
            var cultureInfo = Thread.CurrentThread.CurrentCulture;
            var textInfo = cultureInfo.TextInfo;
            var titleCase = textInfo.ToTitleCase(textInfo.ToLower(str));
            return titleCase;
        }
}

Related Tutorials