62,614
社区成员
发帖
与我相关
我的任务
分享
//写一个笨的方法吧。
private static boolean isExist(){
boolean rtn=true;
String isExist_words="paper manage ";
String words = "this is a perfect paper paper for the data management!";
String regex="\\b\\w+\\b";
List<String> list1=new ArrayList<String>();
List<String> list2=new ArrayList<String>();
Matcher m1=Pattern.compile(regex).matcher(isExist_words);
while(m1.find()){
list1.add(m1.group());
}
Matcher m2=Pattern.compile(regex).matcher(words);
while(m2.find()){
list2.add(m2.group());
}
if(list1.size()<=0||list2.size()<=0)
rtn=false;
for(String i:list1){
if(!list2.contains(i))
rtn=false;
}
return rtn;
}