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