diff --git a/components/lazutils/lazstringutils.pas b/components/lazutils/lazstringutils.pas index e77a91d813..96489d6fff 100644 --- a/components/lazutils/lazstringutils.pas +++ b/components/lazutils/lazstringutils.pas @@ -63,7 +63,7 @@ function SpecialCharsToSpaces(const s: string; FixUTF8: boolean): string; function ShortDotsLine(const Line: string): string; function BeautifyLineXY(const Filename, Line: string; X, Y: integer): string; function BreakString(const s: string; MaxLineLength, Indent: integer): string; -function IntToStrWithSuffix(i: PtrInt): string; +function IntToStrWithSuffix(Value: PtrInt): string; // Conversions to and from a StringList function SplitString(const s: string; Delimiter: char): TStrings; @@ -902,30 +902,30 @@ begin until false; end; -function IntToStrWithSuffix(i: PtrInt): string; +function IntToStrWithSuffix(Value: PtrInt): string; // Like IntToStr but adds system ThousandSeparator and suffix k,M,G,T for big numbers. var ThousandSep: String; Neg: Boolean; p: Integer; begin - if i=0 then + if Value=0 then exit('0'); Result:=''; - Neg:=i<0; + Neg:=Value<0; if Neg then - i:=-i; // Absolute value - if i>=100000 then begin - i:=i div 1000; + Value:=-Value; // Absolute value + if Value>=100000 then begin + Value:=Value div 1000; Result:='k'; - if i>=100000 then begin - i:=i div 1000; + if Value>=100000 then begin + Value:=Value div 1000; Result:='M'; - if i>=100000 then begin - i:=i div 1000; + if Value>=100000 then begin + Value:=Value div 1000; Result:='G'; - if i>=100000 then begin - i:=i div 1000; + if Value>=100000 then begin + Value:=Value div 1000; Result:='T'; end; end; @@ -938,13 +938,13 @@ begin else ThousandSep:=DefaultFormatSettings.ThousandSeparator; p:=0; - while i>0 do begin + while Value>0 do begin if p=3 then begin Result:=ThousandSep+Result; p:=0; end; - Result:=chr((i mod 10)+ord('0'))+Result; - i:=i div 10; + Result:=chr((Value mod 10)+ord('0'))+Result; + Value:=Value div 10; inc(p); end; if Neg then