⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 modstr.bas

📁 B6 And Windows
💻 BAS
字号:
Attribute VB_Name = "modStr"
Sub Searchfile(sFile As String, sSearch As String, ibyte _
    As Boolean, iUniCode As Boolean)
    'sFile - file name
    'sSearch - string to search for
    'ibyte - use byte array to search
    'iUniCode - look for UniCode strings
    Dim iHandle As Integer
    Dim sTemp As String
    Dim lSpot As Long
    Dim lFind As Long
    Dim sSearch1 As String
    Dim bTemp() As Byte
    'another advantage of using a byte array
    '
    'is that we can easily look for UniCode
    '     strings


    If iUniCode Or (Not ibyte) Then
        'this line will look for unicode strings
        '
        'when using byte arrays, regular
        'strings when using string variable
        sSearch1 = sSearch
    Else
        'this line will look for ANSII strings
        'when looking through a byte array
        sSearch1 = StrConv(sSearch, vbFromUnicode)
    End If
    iHandle = FreeFile
    Open sFile For Binary Access Read As iHandle


    If iHandle Then
        sTemp = Space$((LOF(iHandle) / 2) + 1)
        ReDim bTemp(LOF(iHandle)) As Byte


        If ibyte Then
            Get #iHandle, , bTemp
            sTemp = bTemp
        Else
            Get #iHandle, , sTemp
        End If
        Close iHandle
    End If


    Do


        If ibyte Then
            lFind = InStrB(lSpot + 1, sTemp, sSearch1, 1)
        Else
            lFind = InStr(lSpot + 1, sTemp, sSearch1, 1)
        End If
        lSpot = lFind
    Loop Until lFind = 0
End

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -