by Chris_Lucas (5 Submissions)
Category: VB function enhancement
Compatability: Visual Basic 3.0
Difficulty: Advanced
Date Added: Wed 3rd February 2021
Rating: (11 Votes)
This code runs as much as 5000 times faster than VB's InStr function! I've used the Boyer-Moore algorithm which is the fastest string search algorithm in the world. The longer strings you feed this function, the harder it wails on VB's. Switching to vbTextCompare is like lighting the afterburners. Please vote and leave feedback!
Side Effects
Do not us vbTextCompare mode if one or more of your strings contain ligatures (Æ,æ,Œ,œ,Þ, and þ), the German sharp s (ß), or non-ANSI characters. These characters are considered two characters in vbTextCompare mode and are not easily accounted for by the Boyer-Moore algorithm.