码迷,mamicode.com
首页 > 其他好文 > 详细

字符串去除空格,换行

时间:2018-11-22 17:18:55      阅读:162      评论:0      收藏:0      [点我收藏+]

标签:去除   员工   employees   代码   string   replace   ace   str   空格   

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

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

 

这个是我们想要的字符串

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

字符串去除空格,换行

标签:去除   员工   employees   代码   string   replace   ace   str   空格   

原文地址:https://www.cnblogs.com/Children-qiuzhen/p/10001793.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!