string str = "Nothing is difficult, if you put your heart into it";
string[] strs = str.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);//切除空格
Array.Reverse(strs); //我的只是直接调用数组的反转方法而已,其他的和你的差不多
for (int i = 0; i < strs.Length; i++)
{
Console.Write(" {0}",strs);
}
Console.ReadKey(); |