Skip to content
Permalink
Browse files

Fix wrong sorting in database tab and various other lists. Closes #570

  • Loading branch information...
ansgarbecker committed May 18, 2019
1 parent 178d92e commit 99e095fc39884f8228821c292def0fdab85ac42b
Showing with 10 additions and 2 deletions.
  1. +10 −2 source/apphelpers.pas
@@ -366,6 +366,7 @@ TAppSettings = class(TObject)
SystemImageList: TImageList;
mtCriticalConfirmation: TMsgDlgType = mtCustom;
ConfirmIcon: TIcon;
NumberChars: TSysCharSet;

implementation

@@ -614,7 +615,7 @@ function CleanupNumber(Str: String): String;

HasDecimalSep := False;
for i:=1 to Length(Str) do begin
if CharInSet(Str[i], ['0'..'9', FormatSettings.DecimalSeparator]) or ((Str[i] = '-') and (Result='')) then
if CharInSet(Str[i], NumberChars) or ((Str[i] = '-') and (Result='')) then
begin
// Avoid confusion and AV in StrToFloat()
if (FormatSettings.ThousandSeparator = FormatSettings.DecimalSeparator) and (Str[i] = FormatSettings.DecimalSeparator) then
@@ -624,8 +625,11 @@ function CleanupNumber(Str: String): String;
continue;
if Str[i] = FormatSettings.DecimalSeparator then
HasDecimalSep := True;
if Str[i] = FormatSettings.ThousandSeparator then
Continue;
Result := Result + Str[i];
end;
end else
Break;
end;
if (Result = '') or (Result = '-') then
Result := '0';
@@ -4266,6 +4270,10 @@ function TAppSettings.DirnameBackups: String;



initialization

NumberChars := ['0'..'9', FormatSettings.DecimalSeparator, FormatSettings.ThousandSeparator];


end.

0 comments on commit 99e095f

Please sign in to comment.
You can’t perform that action at this time.