#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# 字符串中多个连续空格转为一个空格的内容,更多相关内容请关注php中文网(www.php.cn)!










