String str="123abc456";
if(str.indexOf("abc")!=-1){
System.out.println("包含");
}else{
System.out.println("不包含");
}
java中检验字符串中包含某个字符或字段的方法
最新推荐文章于 2023-06-15 10:45:38 发布
String str="123abc456";
if(str.indexOf("abc")!=-1){
System.out.println("包含");
}else{
System.out.println("不包含");
}