I needed a way to build a string in a loop for import into a DataWindow but speed was important.
I created an object with functions that allows for string concatenation using a blob variable that is allocated once and no external function calls are needed.
To test my object I concatenated a string of 445 characters to a new string 500 times. The standard method seen here took 320 milliseconds:
ls_data = "-start-"
For li_idx = 1 To 500
ls_data = ls_data + "-" + String(li_idx) + "-"
ls_data = ls_data + is_string
Next
The test using my object seen here took only 20 milliseconds:
n_stringclass sc
sc.alloc(225000)
sc.copy("-start-")
For li_idx = 1 To 500
sc.concat("-" + String(li_idx) + "-")
sc.concat(is_string)
Next
ls_data = sc.value()