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;
}
判断字符串是否有重复
最新推荐文章于 2024-05-13 06:03:25 发布
2578

被折叠的 条评论
为什么被折叠?



