To Sentence Case - CSharp System

CSharp examples for System:String Case

Description

To Sentence Case

Demo Code


using System.Text.RegularExpressions;
using System.Text;
using System.Security.Cryptography;
using System.Web;
using System.Linq;
using System.Collections.Generic;
using System;/* ww  w. j a va 2 s.c o m*/

public class Main{
        public static string ToSentenceCase(string str)
    {
        return Regex.Replace(str, "[a-z][A-Z]", m => m.Value[0] + " " + char.ToLower(m.Value[1]));
    }
}

Related Tutorials