国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

小工具:統計有多少行JS代碼和ASP代碼,并有多少字節

2019-11-18 19:07:59
字體:
來源:轉載
供稿:網友

計算當前文件夾中,有多少行JS代碼和asp代碼,并且還可統計代碼有多少字節

有示例代碼

<%
'///////////////////////////////////////////
'//
'//    來自 code'//    修改 bluedestiny
'//    mail:bluedestiny at 126.com
'//
'///////////////////////////////////////////

option explicit
response.buffer=false

class COUNT_CODE
 private
fso,spath
 private asplines, jslines, aspbytes, jsbytes, aspWords
 private sub class_initialize
  set fso = createobject("scr end sub
 private sub class_terminate
  set fso=nothing
 end sub
 private function iterate(path)
  dim folder, folders, files, file, ts, txt, arr, f
  set folder = fso.getfolder(path)
  set files = folder.files
  dim rx, c
  set rx = new regexp
  rx.ignorecase = true
  rx.global = true
  rx.pattern = "  +"
  for each file in files
   if right(file.name,4)=".asp" or right(file.name,3)=".js" then
    set ts = file.openastextstream
    if ts.atendofstream then txt = "" else txt = ts.readall
    ts.close
    txt = rx.replace(txt," ")
    txt = replace(txt,vbcrlf&vbcrlf,vbcrlf)
    arr = split(replace(txt,vbcrlf," ")," ")
    aspwords = aspwords + ubound(arr)
    arr = split(txt,vbcrlf)
    if right(file.name,4)=".asp" then
     asplines = asplines + ubound(arr)
     aspbytes = aspbytes + len(txt)
    else
     jslines = jslines + ubound(arr)
     jsbytes = jsbytes + len(txt)
    end if
   end if
  next
  set folders = folder.subfolders
  for each f in folders
   iterate f.path
  next
 end function

 public property let path(s)
  spath=server.mappath(s)
 end property
 public sub count
  iterate(spath)
 end sub
 public sub printf
  response.write "ASP:" & "<br/>"
  response.write "Total Lines Coded: " & asplines & "<br/>"
  response.write "Total Bytes: " & aspbytes & "" & "<br/>"
  response.write "Total Individual Elements (words) Typed: " & aspwords & "<br/>"
  response.write "JScript:" & "<br/>"
  response.write "Total Lines Coded: " & jslines & "<br/>"
  response.write "Total Bytes: " & jsbytes
 end sub
end class

'////////////////////////////////////////////////////////////
'//示例代碼
'////////////////////////////////////////////////////////////

dim o
set o=new COUNT_CODE
o.path="bluedestiny/"
o.count
o.printf
%>


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 浑源县| 武宁县| 仪陇县| 社旗县| 田阳县| 文成县| 尼玛县| 峡江县| 宁乡县| 通江县| 汽车| 东丽区| 铁岭市| 丹东市| 安泽县| 新疆| 蚌埠市| 廉江市| 镶黄旗| 林周县| 宁德市| 丹巴县| 阿鲁科尔沁旗| 崇左市| 密山市| 云南省| 伊宁市| 阿荣旗| 油尖旺区| 利川市| 湖南省| 阳泉市| 万宁市| 东丰县| 大姚县| 汉阴县| 北安市| 仙游县| 巴中市| 贵港市| 永仁县|