Reputation:
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.
Upvotes: 1
Views: 68
Reputation: 6363
If you only plan to only support US-ASCII you can just loop through the characters of the String and remove all that have a value higher than 255
Upvotes: 0
Reputation: 26077
non-US-ASCII (i.e. outside 0x0-0x7F) characters
public static void main(String[] args) {
String s = "Radial™";
s = s.replaceAll("[^\\x00-\\x7f]", "");
System.out.println(s);
}
Output
Radial
Upvotes: 1