String str="123abc456";
if(str.indexOf("abc")!=-1){
System.out.println("包含");
}else{
System.out.println("不包含");
}
java中检验字符串中包含某个字符或字段的方法

String str="123abc456";
if(str.indexOf("abc")!=-1){
System.out.println("包含");
}else{
System.out.println("不包含");
}