I want to detect and remove high-ASCII characters like ®, ©, ™ from a String in Java. Is there any open-source library that can do this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you need to remove all non-US-ASCII (i.e. outside 0x0-0x7F) characters, you can do something like this:
If you need to filter many strings, it would be better to use a precompiled pattern:
And if it’s really performance-critical, perhaps Alex Nikolaenkov’s suggestion would be better.