by David Bue Pedersen (1 Submission)
Category: String Manipulation
Compatability: Visual Basic 5.0
Difficulty: Advanced
Date Added: Wed 3rd February 2021
Rating:
(15 Votes)
The purpose of this code is to prevent performance leak when repeatingly appending text to a string "the normal way" eg. string1 = string1 & "text". By using stringbuffering you allocate a large ammount of zero-bytes to your string, and then uses the mid function to insert the text you want to append. The biggest gain by using stringbuffering is that you speed ud your code by a factor 1000 but it's allso harder to get your code to crash with a "Out of memory" error (IF YOU LIKE THE CODE, PLEASE VOTE!)
Inputs
The string you want to append, and an index value, telling which buffer you want to append to.
Assumes
Use:
AppendToBuffer MyString, iIndex
instead of:
String1 = String1 & Mystring
Code Returns
the entire string, being your the string plus the text you appended-
Side Effects
None as far as i know :-)
Download Speed up code with a factor 1000 using string buffering (3 KB)