我有一个如下字符串:
#CI[20131229]CO[20131231]PV1,#CI[20130918]CO[20130919]PV3,#CI[20131009]CO[20131011]PV3,#CI[20131226]CO[20140103]PV4,#CI[20131226]CO[20140103]PV3
....列表以相同的格式继续。格式为:
,# = entry seperator
CI[YYYYMMDD] = Check In Date
CO[YYYYMMDD] = Check Out Date
PVx = Room Number
我想在签入和结帐中获取所有日期,除了签入结帐日期并放入这样的字符串(如果是上面的字符串):
#20131230PV1,#20131010PV3,#20131227PV3,#20131228PV3,#20131229PV3,#20131230PV3,#20131231PV3,#20140101PV3,#20140102PV3
我需要分别检索 CheckIn 日期和 Checkout 日期我成功地做到了这一点:
bookcaldatesci.innerHTML = bookcaldates.innerHTML.replace(/CO[^\]]+\]/ig, "");
bookcaldatesci.innerHTML = bookcaldatesci.innerHTML.replace(/CI\[/ig, "");
bookcaldatesci.innerHTML = bookcaldatesci.innerHTML.replace(/\]/ig, "");
bookcaldatesco.innerHTML = bookcaldates.innerHTML.replace(/CI[^\]]+\]/g, "");
bookcaldatesco.innerHTML = bookcaldatesco.innerHTML.replace(/CO\[/ig, "");
bookcaldatesco.innerHTML = bookcaldatesco.innerHTML.replace(/\]/ig, "");
jQuery.noConflict();
$(bookcaldatesci.innerHTML).css({'background-image':'url("img/booked.jpg")','background-repeat':'no-repeat','background-position-y':'100%','background-size':'100% 50%'});
$(bookcaldatesco.innerHTML).css({'background-image':'url("img/booked.jpg")','background-repeat':'no-repeat','background-size':'100% 50%'});
但是要在日期范围之间添加日期,我有点迷失了..
(我得到了答案:要检查,请在下面检查我的答案)