public static String stringToFormat(String value) { StringBuffer realString = new StringBuffer(); //String formatData=""; char[] chars = value.toCharArray(); for (int i = 0; i < chars.length; i++) { if((int)chars[i]!=0){ realString = realString.append(chars[i]); } } //暂时取消对空格的过滤,否则展现太丑// Pattern p = Pattern.compile("\\s*|\t|\r|\n");// Matcher m = p.matcher(realString);// formatData = m.replaceAll("").replaceAll(" ", ""); return realString.toString(); }
过滤从linux抓取的空字符串
最新推荐文章于 2023-06-16 09:53:13 发布