Make a uppercase string character to lowercase and vice-versa

Its a program to change a uppercase letter to lowercase and  the lower case letter to uppercase.

The input is a string.


        static void Main(string[] args)
        {
           Console.WriteLine(CheckNo("abcdEF"));
           Console.ReadLine();
        }

 public static string CheckNo(string s)
        {
            StringBuilder sb = new StringBuilder();
            Char ch ;
            char[] arr1;
            char[] c = s.ToCharArray();

            for (int i = 0; i < c.Length; i++)
            {
                if (Char.IsUpper(c[i]))
                {
                    ch = Char.ToLower(c[i]);
                }
                else
                    ch = Char.ToUpper(c[i]);

                sb.Append(ch.ToString());
            }

            return sb.ToString();
        }

Comments

Popular posts from this blog

Solution of This Error : Error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.

How to creat slideshow in javascript