...show numbers with thousand separators?
|
Autor:
Johan Sageryd |
[ Print tip
] | | |
function AddThousandSeparator(S: string; Chr: Char): string;
var
I: Integer;
begin
Result := S;
I := Length(S) - 2;
while I > 1 do
begin
Insert(Chr, Result, I);
I := I - 3;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Edit1.Text := AddThousandSeparator('400500210', '''');
// -- 400'500'210
end;
// Other possibility / andere Möglichkeit: ThousandSeparator := '''';
label1.Caption := FormatFloat('#,###,###.###', 23453452);
// --> 23'453'452
|