判斷不等于空的情況,千萬不要搞混淆。
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;iif(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 +"'";
}