Pattern pattern = Pattern.compile("[\\s\\p{Zs}]"); Matcher re = pattern.matcher(imageURLString); imageURLString=re.replaceAll("");//去掉空白