用indexOf()函数,不包含则返回-1,包含返回0;



String str="ABC_001";

if(str.indexOf("ABC")!=-1){

   System.out.println("包含");

}

else{
   System.out.println("不包含");
}