将字符串中多个空格替换成一个空格

Regex regex = new Regex(@"/s+", RegexOptions.IgnoreCase); string str = "aa bb d dddd"; str = regex.Replace(str, " "); Response.Write("");

你可能感兴趣的:(ASP.NET)