Java - removing strange characters from a String

前端 未结 11 670
轮回少年
轮回少年 2020-12-10 03:04

How do I remove strange and unwanted Unicode characters (such as a black diamond with question mark) from a String?

Updated:

Please tell me the Unicode chara

11条回答
  •  感情败类
    2020-12-10 03:28

    To delete non-Latin symbols from the string I use the following code:

    String s = "小米体验版 latin string 01234567890";
    s = s.replaceAll("[^\\x00-\\x7F]", "");
    

    The output string will be: " latin string 01234567890"

提交回复
热议问题