InStrRev for VB5
This is a InStrRev function for VB5. I took a look at the one microsoft recomend, and almost died of laughter.
AI
AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Source Code
Function myInStrRev(strStringToSearch As String, strFind As String, Optional iStart As Long) As Long Dim ip1 As Long, ip2 As Long Dim iLenStringToSearch As Long 'get the length of the string iLenStringToSearch = Len(strStringToSearch) 'if the start is 0 then set the start to the length 'og the string If iStart = 0 Then iStart = iLenStringToSearch End If ip1 = 1 Do ip2 = InStr(ip1, strStringToSearch, strFind) If (ip2 > 0) And (ip2 < iStart) Then 'if ip2 is not zero and it is less than the 'place to start searching then set the function 'to return that position myInStrRev = ip2 ElseIf ip2 = 0 Then ip2 = iLenStringToSearch End If 'set the next position to seracf from ip1 = ip2 + 1 Loop Until ip1 >= iStart End Function
Original Comments (3)
Recovered from Wayback Machine