1、工具方法
public static List<String> isContain(String sourceStr, String[] targetSourceArr) { List<String> containList = new ArrayList<>(); for(String targetSource : targetSourceArr) { //对/要做特殊处理,因为正则也无法处理这个 if(sourceStr.contains(targetSource)) { containList.add(targetSource); } } return containList; }
2、方法的使用(返回的List是包含的字符串)
String[] arr = new String[] {"*","/"}; List<String> containStrList = HFStringUtil.isContain(ecnName, arr);
标签:字符,arr,String,包含,List,targetSource,containList,字符串 From: https://www.cnblogs.com/wwssgg/p/17102976.html