InStrRev pro VB5

Funkce:
Public Function vb5InstrRev(ByVal StringCheck As String, _
StringMatch As String, Optional Start As Long = -1, _
Optional Compare As VbCompareMethod = vbBinaryCompare) _
As Long

   'PARAMETRY: StringCheck: ╪et∞zec pro prohledßnφ.
   'StringMatch: ╪et∞z, kter² se mß najφt
   'Start (VolitelnΘ): Startovacφ pozice pro ka₧dΘ hledßnφ. Pokud je vynechßna, 
   'vyhledßvßnφ zaΦne na pozici poslednφho znaku.
   'Compare (VolitelnΘ): UrΦuje druh porovnßvßnφ, defaultnφ je vbBinaryCompare
   'P╪═KLAD: debug.print(vb5InstrRev("www.tabor.cz/bozena, ".")
   'POZN┴MKA: VB6 mß funkci InStrRev zabudovßnu

   If Len(StringMatch) > Len(StringCheck) Then Exit Function
   If Start < -1 Or Start = 0 Or Start > Len(StringCheck) _
      Then Exit Function

   Dim lStartPoint As Long
   Dim lEndPoint As Long
   Dim lSearchLength As Long
   Dim lCtr As Long
   Dim sWkg As String

   lSearchLength = Len(StringMatch)
   lStartPoint = IIf(Start = -1, Len(StringCheck), Start)
   lEndPoint = 1

   For lCtr = lStartPoint To lEndPoint Step -1
      sWkg = Mid(StringCheck, lCtr, lSearchLength)
      If StrComp(sWkg, StringMatch, Compare) = 0 Then
         vb5InstrRev = lCtr
         Exit Function
      End If
   Next

End Function

Zp∞t

Autor: The Bozena