' --- Find the last occurance of a string
' simulair to instring, but scanning from the end of the string
Function InstrLast(ByVal s_string As String, ByVal s_search As String) As Integer
If Len(s_string) <= Len(s_search) Then
' --- search key is bigger then search source ...
Return -1
End If
For f = Strings.Len(s_string) - Len(s_search) To 1 Step -1
If Strings.Mid(s_string, f, Len(s_search)) = s_search Then
Return f
End If
Next
Return -1
End Function
Determine the last occurance of a string within another
This function returns the last occurance of a string within another one, comparable to the InStr function but working from the end of the string.