java判断A字符串是否包含B字符串

 
 
判断是否包含字符串方法如下:
public static void main(String[] args)
 {

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


猜你喜欢

转载自blog.csdn.net/qq_36411874/article/details/80085323