简体   繁体   中英

Special characters in text

How to remove special characters in a value for ex. "Radial™". Due to presence of "TM" in "Radial" facing issues. Is there a way to remove such characters from entire json file. The special text could be dynamic.

non-US-ASCII (ie outside 0x0-0x7F) characters

 public static void main(String[] args) {
        String s = "Radial™";
        s = s.replaceAll("[^\\x00-\\x7f]", "");
        System.out.println(s);
    }

Output

Radial

如果仅计划仅支持US-ASCII,则可以循环访问String的字符并删除所有值大于255的字符

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM