In Java, what is the most efficient way of removing given characters from a String? Currently, I have this code:
private static String processWord(String x)
Use String#replaceAll(String regex, String replacement) as
String#replaceAll(String regex, String replacement)
tmp = tmp.replaceAll("[,.;!?(){}\\[\\]<>%]", ""); System.out.println( "f,i.l;t!e?r(e)d {s}t[r]ig%".replaceAll( "[,.;!?(){}\\[\\]<>%]", "")); // prints "filtered string"