Public Function IsGoodInStrRev(Optional fLigaturesToo As Boolean) As Boolean
' verify correct InStrRev returns, 20021005
' returns True if all tests are passed
Dim fFailed As Boolean
With New CInStrMarzo
' replace ".InStrRev08" with the name of your function
If .InStrRev08("abab", "ab") <> 3 Then Stop: fFailed = True
If .InStrRev08("abab", "aB") <> 0 Then Stop: fFailed = True
If .InStrRev08("abab", "aB", , vbTextCompare) <> 3 Then Stop: fFailed = True
If .InStrRev08("abab", "ab", 2) <> 1 Then Stop: fFailed = True
If .InStrRev08("abab", "ab", 3) <> 1 Then Stop: fFailed = True
If .InStrRev08("abab", "ab", 4) <> 3 Then Stop: fFailed = True
If .InStrRev08("aaabcab", "abc", 4) <> 0 Then Stop: fFailed = True
If .InStrRev08("abab", "", 4) <> 4 Then Stop: fFailed = True
If .InStrRev08("abab", "", 5) <> 0 Then Stop: fFailed = True
If .InStrRev08("", "", 4) <> 0 Then Stop: fFailed = True
If .InStrRev08("abab", "c") <> 0 Then Stop: fFailed = True
If .InStrRev08("a" & String$(50000, "b"), "a") <> 1 Then Stop: fFailed = True
' unicode
If .InStrRev08("a€€c", "€") <> 3 Then Stop: fFailed = True
' the 4 stooges: š/Š, œ/Œ, ž/Ž, ÿ/Ÿ (154/138, 156/140, 158/142, 255/159)
If .InStrRev08("Hašiš", "Š", , vbTextCompare) <> 5 Then Stop: fFailed = True
' ligatures textcompare (VBspeed entries do NOT have to pass this test)
If fLigaturesToo Then
' ligatures, a digraphemic fun house: ss/ß, ae/æ, oe/œ, th/þ
If .InStrRev08("Straße", "ss", , vbTextCompare) <> 5 Then Stop: fFailed = True
End If
End With
' well done
IsGoodInStrRev = Not fFailed
End Function
Back to InStrRev