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

📄 code111a.txt

📁 VB大全(精华版)源代码
💻 TXT
字号:
Public Sub Find_String(ByVal String1 As String, ByVal String2 As String, ByRef StartPos, ByRef strLength, ByRef Endpos)
  Dim I As Integer

  strLength = Len(String2)
  For I = 1 To (Len(String1) - strLength - 1)
    If Mid(String1, I, strLength) = String2 Then
      StartPos = I
      Endpos = strStart + strLength - 1
      Exit Sub
    End If
  Next
  StartPos = 0
End Sub
Public Sub Main()
  Dim strStart As Integer, strLength As Integer, Endpos As Integer
  
  StartPos = 0
  Endpos = 0
  strLength = 0

  Debug.Print "Looking for Abc in AbcDef"
  Find_String "AbcDef", "Abc", StartPos, Length, Endpos
  If StartPos > 0 Then
    Debug.Print "Start, Length, End:", StartPos, strLength, Endpos
  Else
    Debug.Print "Not found."
  End If

  Debug.Print "Looking for Abc in abcDef"
  Find_String "abcDef", "Abc", StartPos, strLength, Endpos
  If StartPos > 0 Then
    Debug.Print "Start, Length, End:", StartPos, strLength, Endpos
  Else
    Debug.Print "Not found."
  End If

  Debug.Print "Looking for Abc in AbcAbc"
  Find_String "AbcAbc", "Abc", StartPos, strLength, Endpos
  If StartPos > 0 Then
    Debug.Print "Start, Length, End:", StartPos, strLength, Endpos
  Else
    Debug.Print "Not found."
  End If

End Sub

⌨️ 快捷键说明

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