C#去掉字符串两端空格以及去掉字符串中多余空格保留一个空格

1 string str = " asdf asd saddf sdfwrqeqw a asdf ";
2 string[] strs = str.Trim().Split(new char[]{' '},StringSplitOptions.RemoveEmptyEntries);
3 string finallStr = string.Join(" ",strs);
原文地址:https://www.cnblogs.com/dotnetHui/p/7999924.html