There is no direct method like ToUpper(), ToLower() for Title Case. But using CultureInfo and TextInfo classes we can do Title case of a string. Below method will convert the first character of each word to uppercase.
The references used:
  1. using System.Globalization;
  2. using System.Threading;
  3. protected void Page_Load(object sender, EventArgs e)
  4. {
  5. CultureInfo cultureInfo = Thread.CurrentThread.CurrentCulture;
  6. TextInfo textInfo = cultureInfo.TextInfo;
  7. Response.Write(textInfo.ToTitleCase("csharpCornerHome<br />"));
  8. Response.Write(textInfo.ToTitleCase("csharp Corner Home"));
  9. Response.Write(textInfo.ToTitleCase("csharp@corner$home<br/>").Replace("@","").Replace("$", ""));
  10. }
Note:
The method will convert the first letter to uppercase and rest all letters to lowercase.
If you have a single word and want to convert some of the characters to uppercase, for example: Csharpcornerhome to CsharpCornerHome you can achieve this by using special characters.
You can find the difference in above all outputs. Please post your comments.