use a case-insensitive regex in strptime; fixes #2324
This commit is contained in:
Родитель
f25f2fa17a
Коммит
9fd0afa69c
|
@ -5782,7 +5782,7 @@ LibraryManager.library = {
|
|||
pattern = pattern.replace(new RegExp('\\%'+pattern[i+1], 'g'), '');
|
||||
}
|
||||
|
||||
var matches = new RegExp('^'+pattern).exec(Pointer_stringify(buf))
|
||||
var matches = new RegExp('^'+pattern, "i").exec(Pointer_stringify(buf))
|
||||
// Module['print'](Pointer_stringify(buf)+ ' is matched by '+((new RegExp('^'+pattern)).source)+' into: '+JSON.stringify(matches));
|
||||
|
||||
function initDate() {
|
||||
|
|
|
@ -2,6 +2,15 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
void ReadMonth(const char *month)
|
||||
{
|
||||
tm value = {0};
|
||||
if(strptime(month, "%b", &value))
|
||||
{
|
||||
printf("%s: %d\n", month, value.tm_mon);
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
struct tm tm;
|
||||
char *ptr = strptime("17410105012000", "%H%M%S%d%m%Y", &tm);
|
||||
|
@ -24,4 +33,26 @@ int main() {
|
|||
: "ERR")))))),
|
||||
tm.tm_mon + 1, tm.tm_mday, tm.tm_year + 1900, tm.tm_hour, tm.tm_min,
|
||||
tm.tm_sec);
|
||||
|
||||
printf("\n");
|
||||
|
||||
ReadMonth("jan");
|
||||
ReadMonth("january");
|
||||
ReadMonth("feb");
|
||||
ReadMonth("february");
|
||||
ReadMonth("march");
|
||||
ReadMonth("mar");
|
||||
ReadMonth("april");
|
||||
ReadMonth("may");
|
||||
ReadMonth("may");
|
||||
ReadMonth("june");
|
||||
ReadMonth("jul");
|
||||
ReadMonth("august");
|
||||
ReadMonth("september");
|
||||
ReadMonth("oct");
|
||||
ReadMonth("nov");
|
||||
ReadMonth("november");
|
||||
ReadMonth("december");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1 +1,18 @@
|
|||
OK: Wed, 1/5/2000 17:41:1
|
||||
OK: Wed, 1/5/2000 17:41:1
|
||||
jan: 0
|
||||
january: 0
|
||||
feb: 1
|
||||
february: 1
|
||||
march: 2
|
||||
mar: 2
|
||||
april: 3
|
||||
may: 4
|
||||
may: 4
|
||||
june: 5
|
||||
jul: 6
|
||||
august: 7
|
||||
september: 8
|
||||
oct: 9
|
||||
nov: 10
|
||||
november: 10
|
||||
december: 11
|
||||
|
|
Загрузка…
Ссылка в новой задаче