Removed temporary string

pull/2/head
Tatsuhiro Tsujikawa 2011-11-08 23:45:40 +09:00
parent 6ed36b73c1
commit 7f8724c501
1 changed files with 12 additions and 6 deletions

View File

@ -134,17 +134,23 @@ bool parseDate
} }
} }
if(!foundMonth) { if(!foundMonth) {
static std::string MONTH[] = { static const char MONTH[][12] = {
"jan", "feb", "mar", "apr", "jan", "feb", "mar", "apr",
"may", "jun", "jul", "aug", "may", "jun", "jul", "aug",
"sep", "oct", "nov", "dec" }; "sep", "oct", "nov", "dec" };
if((*i).size() >= 3) { if((*i).size() >= 3) {
std::string head((*i).begin(), (*i).begin()+3); bool found = false;
util::lowercase(head); size_t j;
std::string* mptr = std::find(vbegin(MONTH), vend(MONTH), head); for(j = 0; j < 12; ++j) {
if(mptr != vend(MONTH)) { if(util::strieq((*i).begin(), (*i).begin()+3,
&MONTH[j][0], &MONTH[j][3])) {
found = true;
break;
}
}
if(found) {
foundMonth = true; foundMonth = true;
month = std::distance(vbegin(MONTH), mptr)+1; month = j+1;
continue; continue;
} }
} }