How to remove control characters from java string?

You can do something like this if you want to delete all characters in other or control uni-code category

System.out.println(
    "a\u0000b\u0007c\u008fd".replaceAll("\\p{Cc}", "")
); // abcd

Note : This actually removes (among others) ‘\u008f’ Unicode character from the string, not the escaped form “%8F” string.

Courtesy : polygenelubricants ( Replace Unicode Control Characters )

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)