判断不等于空的情况,千万不要搞混淆。
if(orderId != null && !"".equals(orderId)) 中间不是||的关系,是&&的关系。
_________________________________________________________________________________
java正则表达式去掉最后的“,”号。
String custId = "";
for(CustInfo cust : custList){
custId += cust.getId().toString() + "," ;
}
custId = custId.replaceAll( ",$", "" );
JS正则表达式去掉最后的“,”号
String.prototype.replaceAll = function (AFindText,ARepText){
raRegExp = new RegExp(AFindText,"g");
return this.replace(raRegExp,ARepText);
}
var system_ids = document.getElementsByName("system_ids");
var systemvalue="";
if(system_ids.length>0){
for(var i=0;i<system_ids.length;i++){
if(system_ids[i].checked){
system_value = system_value + system_ids[i].value + ",";
}
}
}
system_value = system_value.replaceAll( ",$","" );
if(system_value.length>0){
sql = sql + " and t.system_ids='"+ system_value +"'";
}