首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

求解!该如何处理

2012-05-01 
求解!!急!!!stirng strI am a man变成man a am I不用sprit怎么解决???[解决办法]为什么不用呢public

求解!!急!!!
stirng str="I am a man"; 变成 "man a am I"
不用sprit 怎么解决???

[解决办法]
为什么不用呢

public static string ReverseWords(string sentence)
{
string[] words = sentence.Split(' ');
Array.Reverse(words);
return string.Join(" ", words);
}
[解决办法]

C# code
            MatchCollection mat = Regex.Matches("I am a man", @"\w+\b");            List<string> mclist = new List<string>();            foreach (Match ma in mat)            {                mclist.Add(ma.Value);            }            mclist.Reverse();            foreach (string sm in mclist)            {                Console.Write(sm + " ");            }           /*             man a am I           */
[解决办法]
是不用split吧

热点排行