ASP常用函数 储存单位转换函数:FormatFileSize()
2009-06-04 10:42:29 来源:WEB开发网核心提示:程序代码<%'功能:储存单位转换函数Function FormatFileSize(iSize) Dim aUnits, I aUnits = Array("B", "KB", "MB", "GB", "TB&q
程序代码
<%
'功能:储存单位转换函数
Function FormatFileSize(iSize)
Dim aUnits, I
aUnits = Array("B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB")
I = Log(Abs(iSize)) \ 7
If I > UBound(aUnits) Then I = UBound(aUnits)
FormatFileSize = FormatNumber(iSize / (1024 ^ I), 2, -1) & " " & aUnits(I)
End Function
%>
<%
'功能:储存单位转换函数
Function FormatFileSize(iSize)
Dim aUnits, I
aUnits = Array("B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB")
I = Log(Abs(iSize)) \ 7
If I > UBound(aUnits) Then I = UBound(aUnits)
FormatFileSize = FormatNumber(iSize / (1024 ^ I), 2, -1) & " " & aUnits(I)
End Function
%>
[]
赞助商链接