String[] jsidsz = jsids.split(",");
boolean flag=false;
for (int i = 0; i < jsidsz.length; i++) {
String temp=jsidsz[i];
int count=0;
for (int j = 0; j < jsidsz.length; j++) {
String temp2=jsidsz[j];
//有重复值就count+1
if(temp.equals(temp2)){
count++;
}
}
//由于中间又一次会跟自己本身比较所有这里要判断count>=2
if(count>=2){
flag=true;
}
}
if(flag){
writeJsMessage(response,"alert('为每个班指定考场时,有教室重复安排!');window.returnValue='ok';");
return null;
}
判断字符串是否有重复
猜你喜欢
转载自blog.csdn.net/qq_26171035/article/details/83621168
今日推荐
周排行