const
  KBYTE = 1024;
  MBYTE = 1024 * KBYTE;
  GBYTE = 1024 * MBYTE;

function StrCapacity(AValue: int64): string;
var
  lSuffix: string;
  lValue, lFactor: Extended;
begin
  lValue := AValue;
  if AValue>= GBYTE then
  begin
    lFactor := GBYTE;
    lSuffix := 'GB';
  end
  else if AValue>= MBYTE then
  begin
    lFactor := MBYTE;
    lSuffix := 'MB';
  end
  else if AValue>= KBYTE then
  begin
    lFactor := KBYTE;
    lSuffix := 'KB';
  end
  else
  begin
    lFactor := 1;
    lSuffix := 'Bytes';
  end;
  Result := Format('%5.2f %s', [lValue / lFactor, lSuffix]);
end;
_________________________________________________________________
Instale a Barra de Ferramentas com Desktop Search e ganhe EMOTICONS para o 
Messenger! É GRÁTIS!
http://www.msn.com.br/emoticonpack

Responder a