On 4/15/22 15:00, Gabriel Ivăncescu wrote:
+ if(ctx->version >= SCRIPTLANGUAGEVERSION_ES5) { + while(len--) { + if(buf[len] != '0') { + if(buf[len] == '.') + remove_fraction = TRUE; + break; + } + } + } + + if(remove_fraction && GetLocaleInfoW(ctx->lcid, LOCALE_SDECIMAL, buf, ARRAY_SIZE(buf))) { + p = numstr; + while(*p) { + if(!(p = wcsstr(p, buf))) + break; + frac = p++; + } + if(frac) { + tmp = jsstr_alloc_len(numstr, frac - numstr); + jsstr_release(str); + if(!tmp) + return E_OUTOFMEMORY; + str = tmp; + } + }
This seems hackish, could we have share a helper with toString() and pass its result through GetNumberFormatW instead? Thanks, Jacek