Java去除字符串中的空格、回车、换行符、制表符

Java去除字符串中的空格、回车、换行符、制表符 String rspBody = new String(filePost.getResponseBody(),"utf-8");// Pattern p = Pattern.compile("\\s*|\t|\r|\n"); Matcher m = p.matcher(rspBody); String rspBody = m.replaceAll(""); log.info(rspBody); 单独去除空格 rspBody.m.replaceAll(" ","")

你可能感兴趣的:(java)