把4字节的编码类似0xF0替换掉
private String removeFourChar(String content) {
byte[] conbyte = content.getBytes();
for (int i = 0; i < conbyte.length; i++) {
if ((conbyte[i] & 0xF8) == 0xF0) {
for (int j = 0; j < 4; j++) {
conbyte[i+j]=0x30;
}
i += 3;
}
}
content = new String(conbyte);
return content.replaceAll("0000", "*");
}
网友评论