[BUG] FromFixedDecSep inconsistency

Hi, I found a problem in saving/loading a grid to binary stream, when the decimal separator isn't "." but ",".
While saving "1,23", the function ToFixedDecSep is called, IsType("1,23") returns float, so it returns "1.23", that's what is saved.
Now, when loading data back, "1.23" is read, the function FromFixedDecSep is called, isType("1.23") returns atString because my DecimalSeparator is ",", and it returns "1.23" as "1,23" was expected.

Maybe isType should have an optional ADecimalSeparator parameter so that FromFixedDecSep can check if the value is a number with "."
I think that FromFixedDecSep has currently no effect, as if "." is the DecimalSeparator, it won't do anything, and if it's not ".", it won't be found as atFloat, and won't do anything either
Here is a patch fixing the issue on (AdvGrid v8.3.5.2)




Index: advutil.pas
===================================================================
--- advutil.pas (r?vision 17479)
+++ advutil.pas (copie de travail)
@@ -116,7 +116,8 @@
   function NumDelim(p:char;s:string): Integer;
   function NumChar(p:char;s:string): Integer;
   function NumCharDel(p,del:char;s:string): Integer;
-  function IsType(s: string): TAutoType;
+  function IsType(s: string): TAutoType; overload;
+  function IsType(s: string; ADecimalSeparator: Char): TAutoType; overload;
   function CLFToLF(s: string): string;
   function LFToCLF(s: string): string;
   function HTMLColor(l:dword): string;
@@ -899,6 +900,11 @@
 end;
 
 function IsType(s:string): TAutoType;
+begin
+  Result := IsType(s, DecimalSeparator);
+end;
+
+function IsType(s: string; ADecimalSeparator: Char): TAutoType;
 var
   i: Integer;
   isI,isF,isS,isD,isT: Boolean;
@@ -955,7 +961,7 @@
     if (i = length(s)) and ( (s = 'e') or (s = 'E') or (s = '+') or (s = '-') ) then
       isS := false;
       
-    if not (CheckNum(s) or (s = '-') or (s = ThousandSeparator) or (s = DecimalSeparator) ) then
+    if not (CheckNum(s) or (s = '-') or (s = ThousandSeparator) or (s = ADecimalSeparator) ) then
       isF := False;
 
     if not (CheckNum(s) or (s = DateSeparator)) then
@@ -989,7 +995,7 @@
       lt := i;
     end;
 
-    if (s = DecimalSeparator) then
+    if (s = ADecimalSeparator) then
       Inc(de);
 
     if (s = '-') then
@@ -4298,7 +4304,7 @@
 begin
   Result := s;
 
-  if (IsType(s) in [atFloat, atNumeric]) then
+  if (IsType(s, '.') in [atFloat, atNumeric]) then
   begin
     if (DecimalSeparator <> '.') then
       Result := StringReplace(s, '.', DecimalSeparator, [rfReplaceAll]);

You're correct about this issue and we've applied a fix for this. The next update will address this.

Thank you