by selftaught (17 Submissions)
Category: Miscellaneous
Compatability: VB Script
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating:
(7 Votes)

_Now_ it's as fast as it gets, folks. Yes, Faster than the code from xbeat.net. It beats the stuffing out of VB's intrinsic replace function even without the compiler optimizations. 5x-8x faster, even though it adds the ability to use delimiters and count the number of replacements. Uses a slightly modified string mapping technique from Chris_Lucas's post here a few years ago. Thanks to Rde for the SysAllocStringByteLen declare. That, plus some changes I made to calculate all the replacements before the return string is created are what account for the additional speed in the updated version of this post.
Download Just another Replacement for Replace() v. 1.1 (15 KB)