package test;
public class TestCont {
/**
* @param args
*/
public static void main(String[] args) {
String str = "aaAAbbBBccCC";
String[] s = {"AA","BB","CC","ABCD"};
new TestCont().containstr(str, s);
}
boolean containstr(String str,String[] s){
boolean flag=false;
for (int i = 0; i < s.length; i++) {
if (str.contains(s[i])) {
flag = true;
System.out.println("
字符串"+s[i]+"在"+"指定字符串str中!");
}else {
flag = false;
System.out.println("字符串"+s[i]+"不在"+"指定字符串str中!");
}
}
return flag;
}
}
刚写的JAVA代码,你试试是不是你想要的,如果是的话,请采纳!!