日期:2014-05-16 浏览次数:20811 次
string str = "I love CSDN It can help me";
str = string.Join("", Regex.Split(str, @"((?<=\S)(?=\s+)
------解决方案--------------------
(?<=\s+)(?=\S))").Reverse());
private static string ExChangeStr(string input,char split)
{
string output = string.Empty;
string keyWord = string.Empty;
int len = input.Length;
for(int i=len -1;i >=0;i--)
{
var k = input[i];
if(k == split)
{
output += keyWord;
output += k;
keyWord = string.Empty;
}
else
{
keyWord = k + keyWord;
}
}
//最后一个词
output += keyWord;
return output;
}