private static String SPECIAL_LETTER="[!$^&*+=|{}';'\",<>/?~!#¥%……&*——|{}【】‘;:”“'。,、?-]@¨»¯¼½¾¿¸º¹•¶µ²´³°±¬®«©§¦ª¥¤¿¢£¡¢£¤¥ªµºÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿĀāĂ㥹ĆćĈĉĊċČčĎďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħĨĩĪīĬĭĮįİıIJijĴĵĶķĸĹĺĻļĽľĿŀŁłŃńŅņŇňʼnŊŋŌōŎŏŐőŒœŔŕŖŗŘřŚśŜŝŞşŠšŢţŤťŦŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽž";
//方式1
public static boolean isSpecialSymbols(String value) {
if(SPECIAL_LETTER.contains(value)){
return true;
}
return false;
}
//方式2
public static boolean isSpecialSymbols2(String value) {
char[] specialSymbols=SPECIAL_LETTER.toCharArray();
for(char c : specialSymbols){
if(String.valueOf(c).equals(value)){
return true;
}
}
return false;
}
数据参考https://www.jianshu.com/p/b925b1dfca98