求解!!急!!!
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);
}
[解决办法]
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吧