2020
10-10
10-10
java去除空格、标点符号的方法实例
代码如下:publicclassTempTest{publicstaticvoidmain(String[]args){//string去除空格Stringstr="helloworld";System.out.println(str);Stringstr1=str.trim();//去除首尾空格System.out.println(str1);Stringstr2=str.replace("","");//去掉所有空格,包括首尾,中间System.out.println(str2);Stringstr3=str.replaceAll("+","");//去掉所有空格,包括首尾,中间System.out.println(str3);...
继续阅读 >