字符串去除空格,换行

fchrEmployees 是前端传过来多个员工编号拼接出来的字符串,由于是前端传的所以我们没办法保证是我们想要的字符串,我们可以进行下面的代码处理

fchrEmployees = fchrEmployees.Replace("\n", "").Replace(" ", "").Replace("\t", "").Replace("\r", "");
fchrEmployees.Trim();

这个是我们想要的字符串

string[] strs = fchrEmployees.Split(',');

猜你喜欢

转载自www.cnblogs.com/Children-qiuzhen/p/10001793.html
今日推荐