首页  编辑  

排除相邻的空格

Tags: /C#/字符串处理/正则表达式/   Date Created:

using System . Text . RegularExpressions;

Text = Regex . Replace( "11     22    33     44" , @"( )+" , "$1" );

//or

Text = Regex . Replace( "11     22    33     44" , @"\s+" , " " );