All pastes #277393 Raw Edit

macgeek

public text v1 · immutable
·published 2006-12-13 04:08 UTC
rendered paste body
Function FormatSize(pSize As Integer) As String
  dim nSize As double
  nSize=pSize
  if nSize<1024 then
    Return str(nSize)+" Bytes"
  else
    nSize=nSize/1024
    if nSize<1024 then
      Return format(nSize,"##0.0")+" KB"
    else
      nSize=nSize/1024
      if nSize<1024 then
        Return format(nSize,"##0.0")+" MB"
      else
        nSize=nSize/1024
        if nSize<1024 then
          Return Format(nSize,"##0.0")+" GB"
        else
          nSize=nSize/1024
          Return Format(nSize,"######0.0")+" TB"
        end 
      end
    end
  end
End Function