change text to TitleCase
Published: 11. October 2011 | Updated: 11. October 2011License: Microsoft Public License (MS-PL)
Categories: Globalization » Text
Tags: C# Globalization
Import namespace
using System.Globalization;
Code
var culture = CultureInfo.GetCultureInfo("en-US"); TextInfo textInfo = culture.TextInfo; string original = "changes the first letter of every word in sentense to uppercase"; Console.WriteLine(original); string titleCase = textInfo.ToTitleCase(original); Console.WriteLine(titleCase);Console Output:
changes the first letter of every word in sentense to uppercase
Changes The First Letter Of Every Word In Sentense To Uppercase
Changes The First Letter Of Every Word In Sentense To Uppercase
| Send us feedback about this snippet » |





