GSAK (Geocaching Swiss Army Knife)
AddStr(nBuffer,sAction,[sdata]) : string
Optimized function to concatenate strings. It appears that Delphi is not that flash when it comes to concatenation of long strings with the native + operator when done many times. It appears to be inefficient, slow, and cause severe memory fragmentation.
As a rule of thumb, when adding long strings to the same variable via the native + operand, things start to go South after about 2000 iterations.
The AddStr() function has been introduced to help fix this shortcoming and should be used when building a large string in memory by continually adding other strings to the same variable.
nBuffer - This is an internal buffer number (1 to 10) for storing the large strings
sAction - The action to communicate with our internal buffer
* clear - clear the buffer
* add - add strings to the buffer
* get - retrieve the full contents of the buffer
sData - Optional and only required when sAction is "add"
The AddStr() function works like this
1. Before use you must "clear" the behind the scenes buffer that accumulates the strings
2. You then just keep adding strings as required
3. Finally, to access the "buffer" of data you must "get" it.
Probably the best way to explain is to see it in action.
Alpha List Category List
Copyright 2004-2013 CWE Computer Services |