![]() |
Format funktion mit Int64
hey,
also ich hab da ein problem mit Format( funktion, ich glaub es liegt an den langen zahlen (Int64), aber ich kann nicht die bytes von zb. 50GB festplatte formatieren, also ich würde es so haben wollen zB von 50237591552 zu 50.237.591.552 aber ich bekomm immer ein fehler Zitat:
Delphi-Quellcode:
das ganze funktioniert wenn ich mach [UsedB / 1000] - aber ich wills schon genauer haben
var
UsedB: Int64; begin .. frmMain.lblUsed.Caption := Format('%.n Bytes', [UsedB]); hoffentlich kann mir jemand helfen :) cya |
Re: Format funktion mit Int64
Ich glaub da hilft nur IntToStr(), da Format() meines Wissens nicht 64-bit-fähig ist. Auch die API-Funktion wvsprintf() scheint kein 64-bit zu können.
Delphi-Quellcode:
var
UsedB: Int64; begin .. frmMain.lblUsed.Caption := IntToStr(UsedB) + ' Bytes'; |
Re: Format funktion mit Int64
ja so hatte ich es auch, jedoch ist das so unübersichtlich
|
Re: Format funktion mit Int64
So schaut es netter aus:
Delphi-Quellcode:
Grüße vom marabu
function Format64(z: int64): string;
var i: integer; neg: boolean; begin neg := z < 0; z := abs(z); Result := IntToStr(z); i := Length(Result) - 2; while i > 1 do begin Insert(ThousandSeparator, Result, i); Dec(i, 3); end; if neg then Result := '-' + Result; end; |
Re: Format funktion mit Int64
@marabu: danke sehr! aber ich hab auch ne ähnliche funktion geschrieben, deine is aber kleiner :)
cya |
Alle Zeitangaben in WEZ +1. Es ist jetzt 05:49 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz