d-money ctor(string) has bug, be careful! EUR("1.23456") ==> ctor ==> 3.3456EUR

mw mingwu at gmail.com
Sun May 24 18:30:38 UTC 2020


On Sunday, 24 May 2020 at 18:15:09 UTC, Basile B. wrote:
> On Sunday, 24 May 2020 at 17:06:43 UTC, mw wrote:
>> On Friday, 22 May 2020 at 05:26:45 UTC, mw wrote:
>>> The issue found is here:
>>>
>>> https://github.com/qznc/d-money/issues/11
>>>
>>
>> For anyone who's using this package, just submitted the PR to 
>> fix it:
>>
>> https://github.com/qznc/d-money/pull/12
>
> there's also parsing that is not super compliant
>
> EUR y = EUR("1.000.000,00");
> writeln(y);                     // F!

Added comment here on git:

https://github.com/qznc/d-money/pull/12#issuecomment-633272988

=====================================
The parsing regex used internally is a very simple one:
https://github.com/qznc/d-money/blob/master/source/money.d#L98

I don't want to enhanced it to be a full sscanf().

This is just a maintenance bug fix.




More information about the Digitalmars-d mailing list