What is String Title case in C#?

The ToTitleCase method is used to capitalize the first letter in a word. Title case itself means to capitalize the first letter of each major word.

Let us see an example to get the title case −


 Live Demo

using System;
using System.Globalization;

class Demo {
   static void Main() {
      string str = "jack sparrow";
      string res = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(str);


Jack Sparrow

Above, we have set the input string to the ToTitleCase() method. The CultureInfo.TextInfo property is used to provide the culture-specific casing information for strings −


Updated on: 20-Jun-2020

1K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started