publicstatic String isprint(String str){
if(StringUtils.isEmpty(str)){
return"";
}
byte[] bts =str.getBytes();
intbtsLength= bts.length;
byte[] newBytes = newbyte[btsLength];
for(inti =0;i<btsLength;i++) {
byteb =bts[i];
if((b >=0&& b <=31) || b >=127){
//将不可打印字符至空
b =32;
}
newBytes[i]=b;
}
returnnew String(newBytes);
}