ToProperCase
Converts string to a title case.
Source
public static string ToProperCase(this string text)
{
System.Globalization.CultureInfo cultureInfo = System.Threading.Thread.CurrentThread.CurrentCulture;
System.Globalization.TextInfo textInfo = cultureInfo.TextInfo;
return textInfo.ToTitleCase(text);
}
Example
string s = "tHiS is a sTring TesT";
Console.WriteLine("Title Case: {0}", s.ToProperCase());
// Output: This Is A String Test