string strName = "大 张 伟"; string str = Regex.Replace(strName, @"\s", ""); Response.Write("输出内容:" + str);