String dayStr =
((month<10)?"0"+month:month)+""+((day<10)?"0"+day:day); //
三元表达式
switch (year){
case 2014 :{
if(has(HOLIDAY2014,dayStr))return true;
else return false;
}
case 2015 :{
if(has(HOLIDAY2015,dayStr))return true;
else return false;
}
case 2016 :{
if(has(HOLIDAY2016,dayStr))return true;
else return false;
}
default:{
return false;
}
}
本文深入探讨了在编程中如何运用三元表达式、switch-case结构以及has函数来实现日期判断逻辑,具体展示了如何高效处理不同年份的假期识别问题。
207

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



