java 判断字符串是否包含特定的字符

public static void main(String[] args) {
String str = "四川省成都市";
if(str.indexOf("省")!=-1){
System.out.println("存在");
}else{
System.out.println("不存在!");
}
}

猜你喜欢

转载自www.cnblogs.com/duoyan/p/11793160.html