String split equal parts and reverse the string in c#

         C# Console Application:

           string name;
            name = Console.ReadLine();//string
            int mid = name.Length / 2; //get the middle of the String
            String[] parts = { name.Substring(0, mid), name.Substring(mid) };
            string reverse = new string(parts[0].Reverse().ToArray());
            string reverse2 = new string(parts[1].Reverse().ToArray());
            Console.WriteLine(parts[0]); //first string
            Console.WriteLine(parts[1]); //second string
            Console.WriteLine(reverse);//frist reverse string
            Console.WriteLine(reverse2);//second reverse string
            Console.ReadKey();

Comments

Popular posts from this blog

my reframce

Angular UI Grid To Bind JSON Data