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

 
Best quality Asp .Net Ajax Control Toolkit tutorials.

Give your valuable comments.

Name
Email
Comment
6 + 5 =
 

About Us | Terms of Use | Privacy Policy | Disclaimer | Contact Us Copyright © 2012-2024 CodingFusion
50+ C# Programs for beginners to practice