by Vesa Piittinen (20 Submissions)
Category: Miscellaneous
Compatability: VB Script
Difficulty: Advanced
Date Added: Wed 3rd February 2021
Rating:
(3 Votes)

This code seeks from the end of a byte array trying to find a matching text. Why? Well, handling byte arrays is much faster than handling strings. So, if you needed to parse data real fast and a lot, it would be benefical to do it using a byte array instead of a string.
My starting point to this was rather simple: do the search faster than InStr and InStrRev. Beating the latter was easy: InStrRev isn't of the fastest build-in functions in VB. With InStr I had to taste half of a defeat: it just is superb when it can search in BinaryCompare. But, what if we wanted to do TextCompare? Well, there InBArr and InBArrRev beat real badly both InStr and InStrRev!
Anyways, I hope somebody finds this submission helpful. I'm sorry I didn't comment the code as well as I could/should have, but I hope it doesn't matter as the code should be rather flawless on what it does :) Comments and votes welcome, as always!
Download InBArr and InBArrRev searching strings from a byte array (3 KB)