code117a.txt

来自「VB大全(精华版)源代码」· 文本 代码 · 共 32 行

TXT
32
字号
Public Function r_FindString(ByVal srchString As String, ByVal _
    fndString As String, ByVal strEnd As Integer) as Integer
  
  Dim I As Integer, LastChar As Integer
  Dim CurrentPos As Integer, LastPos As Integer

  If strEnd > 0 then
    LastChar = strEnd
  Else
    LastChar = Len(srchString)
  End If

  Next_Pos = 0

  Do
    Current_Pos = Next_Pos
    Next_Pos = InStr(Current_Pos + 1, srchString, fndString)
  Loop Until (Next_Pos = 0) Or (Next_Pos > LastChar)

  If Current_Pos > 0 Then
    r_FindString = Current_Pos
  Else
    r_FindString = -1
  End If
End Function

Public Sub Main()
  Dim SearchString As String, SearchFor As String 
  Dim Position As Integer

  SearchString ="Tips for eating tri-tip steak."
  SearchFor = "tip"

⌨️ 快捷键说明

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