原文地址:http://topic.csdn.net/u/20080711/14/00183de8-5fdf-4fac-a39c-c4dc343b0de5.html
该程序的c#版本(控制台应用程序):
 using System;
 public class StingReverse
 {
  public static void Main()
  {
  string firststring=Console.ReadLine();//firststring,定义转换前的字符串(请求输入)
  string[] stringarray=firststring.Split(new char[]{' '});//将字符串用空格分解
  string result="";//
  for (int i=stringarray.Length-1;i>=0;i-- ) 
  {
  result+=stringarray[i]+' ';//将分解后的字符倒序相加,生成新的字符串
 
  }
  Console.WriteLine(result);
  }
 }
如题

解决方案 »

  1.   


                string firststring = Console.ReadLine();
                string[] stringarray = firststring.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                Array.Reverse(stringarray);
                string result = string.Join(" ", stringarray);
                Console.Write(result);其实是一样的
      

  2.   

    private string Reverse(string firststring)
     {
       char[] cha= firststring .ToCharArray();
       Array.Reverse(cha);
       return new string(cha);
     }