public static String replaceBlank(String str) { String dest = ""; if (str != null) { //Pattern p = Pattern.compile("\\s*|\t|\r|\n|\\x20"); Pattern p = Pattern.compile("\\s*|\t|\r|\n"); Matcher m = p.matcher(str); dest = m.rep
Python中常见字符串去除空格的方法总结 1:strip()方法,去除字符串开头或者结尾的空格>>> a = " a b c ">>> a.strip()'a b c'2:lstrip()方法,去除字符串开头的空格>>> a = " a b c ">>> a.lstrip()'a b c '3:rstrip()方法,去除字符串结尾的空格>>> a = " a b c