diff --git a/source/helpers.pas b/source/helpers.pas index b5a88bb1..a64f7675 100644 --- a/source/helpers.pas +++ b/source/helpers.pas @@ -1841,13 +1841,16 @@ end; } function FormatNumber( str: String ): String; Overload; var - i, p: Integer; + i, p, Left: Integer; begin Result := str; Result := StringReplace(Result, '.', DecimalSeparator, [rfReplaceAll]); p := Pos(DecimalSeparator, Result); if p = 0 then p := Length(Result)+1; - if p > 0 then for i:=p-1 downto 2 do begin + Left := 2; + if (Length(Result) >= 1) and (Result[1] = '-') then + Left := 3; + if p > 0 then for i:=p-1 downto Left do begin if (p-i) mod 3 = 0 then Insert(ThousandSeparator, Result, i); end;