Problem with comma as decimal separator

Posted by Endaco on  2002-03-26 09:45:10

When the international configuration uses a "," as a decimal separator for numbers then following error appears: Invalid number value for field (Fieldname) in the unit gs6_dbf.pas in line 2142 the function gsStringPutn uses (val() funtion), which only recognizes the "." as a decimal separator.


status: CLOSED    Urgency: LOW    As Of: 2002-03-26 09:45:10

Comment:

Change the code in the gsStringPutN() method to use StrToFloat:
         
         'N' : begin
                  s := TrimRight(st);
                  if length(s) = 0 then
                     v := 0.0
                  else
                  begin
                     try
                        v := StrToFloat(s);
                     except
                        raise EHalcyonError.CreateFmt(gsErrFieldInput,['Number',s1]);
                     end;
                  end;
                  gsStringPutN := gsNumberPutN(fnum, v);
               end;