java中怎么判断一个字符串中包含某个字符或字符串

public static void main(String[] args)
 {

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

 

posted @ 2015-11-05 11:07  星辰之力  阅读(3223)  评论(0编辑  收藏  举报