[vb]使用vb统计.java的行数

 工作需要,针对java文件,作了一个行数统计的工具。统计的主要代码如下:

    Set srcIn = fso.OpenTextFile(fileNm, ForReading)
    
    Do While Not srcIn.AtEndOfStream
        buf = srcIn.ReadLine
       
        'java总行数

        allLinex = allLinex + 1
        'java空白行
        If Not flg And Trim(Replace(buf, vbTab, "")) = "" Then
            'Debug.Print fileNm & ":" & allLinex
            blankLinex = blankLinex + 1
        End If
        'java注释行
        If flg Then
            If InStr(buf, "*/") > 0 Then
                flg = False
            End If
            commentLinex = commentLinex + 1
        ElseIf InStr(Trim(Replace(buf, vbTab, "")), "//") = 1 Then
            commentLinex = commentLinex + 1
        End If
        If InStr(Trim(Replace(buf, vbTab, "")), "/*") = 1 Then
            flg = True
            commentLinex = commentLinex + 1
        End If
        If flg And InStr(buf, "*/") > 0 Then
            If Mid(Trim(Replace(buf, vbTab, "")), Len(Trim(Replace(buf, vbTab, ""))) - 1) = "*/" Then
                flg = False
            End If
        End If
       
    Loop

    'java实行行数
    execLinex = allLinex - blankLinex - commentLinex

 

广告:

优衣库官方旗舰店提示:冬日寒冷,请注意保暖,

http://s.click.taobao.com/a/qvLJJQkPIEQ=-14643766

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值