x.xxxx is not a valid floating point. Converting between languages/locals

前端 未结 4 1779
刺人心
刺人心 2021-01-02 08:20

I have a spanish user who is getting an invalid floating point error when doing this

var
  S : String;
  R : Real;
begin
  S := \'3.12345\';
  R         


        
4条回答
  •  情深已故
    2021-01-02 08:46

    Roll your own version of StrToFloat

    function StrToFloat_UK(const AStr: string): Float;
    var
      FS: TFormatSettings;
    begin
      FS.Create('en-UK');
      Result:= StrToFloat(AStr, FS): 
    end;
    

    And use this in place of StrToFloat.

提交回复
热议问题