mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-11 10:19:13 +02:00
LazUtils: Use parameter name Value in IntToStrWithSuffix(), matching IntToStr() parameter.
This commit is contained in:
parent
d1e7421b13
commit
7c96763d18
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user