by @saigowthamr

How to convert a string into a title case in C#

Home » c-sharp » How to convert a string into a title case in C#

To convert a string to titlecase we can use the TextInfo.ToTitleCase(String) method in c#.

Here is an example:

using System;
using System.Globalization;

class HelloWorld {
  static void Main() {
     String text = "hello world";
     String titleCase=  new CultureInfo("en").TextInfo.ToTitleCase(text.ToLower());
     Console.WriteLine(titleCase);
  }
}

Output:

Hello World