#region 字符串中多个连续空格转为一个空格
///
/// 字符串中多个连续空格转为一个空格
///
/// 待处理的字符串
/// 合并空格后的字符串
public static string MergeSpace(string str)
{
if (str != string.Empty &&
str != null &&
str.Length > 0
)
{
str = new System.Text.RegularExpressions.Regex("[\\s]+").Replace(str, " ");
}
return str;
}
#endregion
C# 字符串中多个连续空格转为一个空格
关注
打赏