C# program to change case of a string
In this C# program, we will take the input string from the user and change it to 1)Upper Case 2)Lower Case 3)Title Case.
C# program to change case of a string Code:
private static void Main(string[] args)
{
string str;
Console.Write("Enter string: ");
str = Console.ReadLine();
Console.WriteLine("");
Console.WriteLine("The string in upper case: {0}", str.ToUpper());
Console.WriteLine("The string in lower case: {0}", str.ToLower());
//---- Convert to Title case
//---- Add namespace using System.Globalization;
TextInfo textInfo = new CultureInfo("en-US", false).TextInfo;
Console.WriteLine("The string in title case: {0}", textInfo.ToTitleCase(str));
Console.ReadLine();
}
C# program to change case of a string Output:
