C# Tip Article
Uppercase, Lowercase, Title case in C#
.NET String class has ToUpper() method which changes all characters to uppercase and ToLower() method which changes all to lowercase.
Title Case (also known as Proper Case) is the case where the first character of each word in the sentence being uppercase and all others being lowercase.
For the sentence "Who are you?", here are casing examples:
|Uppercase||WHO ARE YOU?|
|Lowercase||who are you?|
|Title Case||Who Are You?|
.NET String class does not have any method for Title case. But, there is a method (ToTitleCase) in TextInfo class. So here is the sample code.
string str = "Who are you?"; string upper = str.ToUpper(); // Uppercase string lower = str.ToLower(); // Lowercase TextInfo ti = Thread.CurrentThread.CurrentCulture.TextInfo; string proper = ti.ToTitleCase(str); // Title case (Proper Case)