我在这做错了什么?我只是想将格式化的字符串转换为double,并使用传入的TFormatSettings作为StrToFloat的参数.我得到以下异常:
'3,332.1' is not a valid floating point value.
千位分隔符和小数分隔符是TFormatSettings中的预期值(‘,’和’.’).
procedure TForm2.Button1Click(Sender: TObject); var FS: TFormatSettings; S: String; V: double; begin FS:= TFormatSettings.Create; codesite.Send('ThousandSeparator',FS.ThousandSeparator); //correct ',' codesite.Send('DecimalSeparator',FS.DecimalSeparator); //correct '.' S := '3,332.1'; try V := StrToFloat(S,FS); except on E: Exception do ShowMessage(e.Message); end; CodeSite.Send('S',S); CodeSite.Send('V',V); end;