Change to TitleCase
As everyone knows, string is a reference types and it stores in heap. Class String has two public functions ToLower() and ToUpper(), to change string cases lower and upper respectively.
Here, i would like to show you how to change string case as TitleCase:
public static string ToTitleCase(string strValue)
{
//To check whether the given value is null or empty
if (String.IsNullOrEmpty(strValue))
{
return string.Empty;
}
else //if not, Change case to TitleCase
{
CultureInfo info = Thread.CurrentThread.CurrentCulture;
return info.TextInfo.ToTitleCase(strValue);
}
}
Hope, the above code will helps you when needs.