c#反转

string[] arr = Console.ReadLine().Split(' ');
            string result = string.Empty;
            for (int i = arr.Count() - 1; i >= 0; i--)
            {
                result += arr[i] + " ";
            }
            Console.WriteLine("反转后的英文句子是:" + result);
            Console.ReadKey();

字母全部反转

 public char[] ceshi(string mess) {
            char[] a = mess.ToCharArray();
            Array.Reverse(a);
            return a;
        
        }
 Class2 ceshi2 = new Class2();
            string ceshi3=string.Empty;
            foreach(char i in ceshi2.ceshi("abc")){
                
              ceshi3+=i.ToString();
            }
            Console.WriteLine(ceshi3)

 

posted @ 2015-09-22 10:55  尘梦  阅读(226)  评论(0编辑  收藏  举报