replaceAll替换空格和回车
2016-12-28 10:31
169 查看
有这个一个任务,用户在停保的时候降停保原因写成加空格和回车的话,再次新申请审批的时候不能带出信息,所以要将停保原因中的回车符去掉,加了两行代码:
stopreason =stopAll.getReason();
stopreason = stopreason.replaceAll("(\r\n|\r|\n|\n\r)", "");//去掉回车
stopreason = stopreason.replaceAll("\\s", ""); //去掉空格
stopreason =stopAll.getReason();
stopreason = stopreason.replaceAll("(\r\n|\r|\n|\n\r)", "");//去掉回车
stopreason = stopreason.replaceAll("\\s", ""); //去掉空格
相关文章推荐
- Sql replace 替换回车去空格
- oracle中replace替换回车换行空格的方法详解
- mysql 字符串替换 REPLACE()函数 剔除内容中空格换行回车
- JavaScript 中的replace方法(全部替换replaceAll效果)
- DOM——拷贝.clone()与替换.replaceWith() 和.replaceAll()及包裹.wrap()
- java 替换掉所有的空格回车换行符
- js使用正则实现ReplaceAll全部替换的方法
- java中字符串的的替换replace和replaceAll的区别
- replaceAll和replace的替换差别
- #linux# 将回车符替换成空格
- 003--js替换全部字符串 - 无replaceAll的解决方案
- String.replaceAll替换目标为反斜杠
- Office -word 【解决排版问题:论文复制过程中产生的大量空格及回车】 快速替换回车与空格
- js替换掉字符串中的空格\回车\换行
- php preg_match_all结合str_replace替换内容中所有img
- JS PHP替换文本框多行文本的空格,回车;去掉字符串最后的逗号
- javascript 实现全部替换(replaceAll)
- php preg_match_all 和 str_replace 替换图片链接
- php中的字符串常用函数 str_replace 字符串替换,替换全角空格
- JavaScript中的replace 达到replace.all函数替换的问题