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:

CSharp-program-to-change-case-of-a-string

 
We are nothing without our users ! You can help us offer even more high quality content. Please share our page !
Best quality Asp .Net Ajax Control Toolkit tutorials.

Give your valuable comments.

Name
Email
Comment
7 + 6 =
 
About Us | Terms of Use | Privacy Policy | Disclaimer | Contact Us Copyright © 2012-2022 CodingFusion
75 Important SQL Server queries you should know