StrToFloat in conjunction with thousandseparator and decimalseparator always gives exception
Original Reporter info from Mantis: tom_at_work
-
Reporter name: Thomas Schatzl
Original Reporter info from Mantis: tom_at_work
- Reporter name: Thomas Schatzl
Description:
See summary
Steps to reproduce:
Run the test program, it reports two errors (exceptions) when converting a string to float
Additional information:
uses sysutils;
var
failed : boolean;
procedure testconvert(s : string);
begin
try
writeln(strtofloat(s));
except
on EConvertError do begin
writeln('Failed to convert ', s, ' to a float value');
failed := true;
end;
end;
end;
begin
failed := false;
thousandseparator := '.';
decimalseparator := ',';
testconvert('1.200'); // working
testconvert('1,200'); // working
testconvert('1.200,23'); // fails
testconvert('1.200.300'); // fails
if (failed) then halt(1);
end.
Mantis conversion info:
- Mantis ID: 9126
- OS: linux
- Build: latest trunk
- Platform: powerpc
- Fixed in version: 2.4.0
- Fixed in revision: 11069 (#e60e078e)
- Target version: 2.4.0