#1 Yesterday 21:22:15

mvg7
Member
Registered: 2021-10-03
Posts: 9

varCurrency is a bit confusing

Hi!
As I understand, since mormot 2 can convert values to varCurrency, unlike Mormot 1, this code wont work If system's decimail separator set as comma:

  
  var APrice: double;
  ToDouble(_JsonFastFloat('{"price": 0.156}').price, APrice);

Im mormot 1 it was like

  
    if AllowVarDouble then
      typ := TextToVariantNumberType(JSON) else
      typ := TextToVariantNumberTypeNoDouble(JSON);

and with delphi's FormatSettings.DecimalSeparator:='.'; the code above worked

Is there any option to prevent the mormot from generating varCurrency ?

Offline

#2 Yesterday 21:40:20

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,778
Website

Re: varCurrency is a bit confusing

I don't understand what you write, because mORMot does not at all take into account FormatSettings.

Offline

#3 Yesterday 22:58:44

mvg7
Member
Registered: 2021-10-03
Posts: 9

Re: varCurrency is a bit confusing

ab wrote:

I don't understand what you write, because mORMot does not at all take into account FormatSettings.

I write that I would expect APrice =  0.156 in this code:

ToDouble(_JsonFastFloat('{"price": 0.156}').price, APrice);

However actually APrice is not  0.156 in Mormot 2.

Offline

Board footer

Powered by FluxBB