Special characters in the string filter

public static String format(String s){
    String str=s.replaceAll("[`~!@#$%^&*()+=|{}':;',\\[\\].<>/?~!@#¥%……& amp;*()——+|{}【】_‘;:”“’。,、?|-]", "");
    return str;
}

 

Just a sample, we have a need, fill it to add it yourself

Guess you like

Origin blog.csdn.net/Peter_S/article/details/89842264