What am I doing wrong here? I just want to convert the formatted string to double and use the TFormatSettings passed as the StrToFloat parameter. I get the following exception:
'3,332.1' is not a valid floating point value.
The decimal separator and decimal separator are the expected values āā(',' and '.') In 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;
source share