ASP按长度数字前补零

<%
'@author 		Leon Lam
'@copyright		(c) 2004 - 2010 Lam's Studio.
'@link			http://www.phpker.com

function formatNum(num, formatLen)
  numLen = len(num)
  if formatLen<numLen then
    formatNum = num
  else
    tmpLen = formatLen-numLen
    for j=1 to tmpLen
      tmpStr = tmpStr&"0"
    next
    formatNum = tmpStr&num
  end if
end function

'用法: formatNum(要转换的数字, 数字长度)
for i=1 to 30
  response.write "<div>"
  response.write formatNum(i, 5)
  response.write "</div>"
next
%>