|
StringBuilder
Classes
StringBuilder
|
StringBuilderWhile using Response.write is far away faster than concatenating strings, sometimes you need to store the entire output before printing it. That’s when a special designed string builder class is required. About
Summary
toString
Concatenate the fragments into a string. Note that since VBScript does not provide a mid assignment statement, we are using the join function which is faster than straight concatenation, but does not scale well when called to concatenate arrays with a large number of elements. Returns
Exampledim sStdConcat, stdConcat_a, stdConcat_b dim sSbConcat, sbConcat_a, sbConcat_b dim i stdConcat_a = timer sStdConcat = "" for i = 0 to 10000 sStdConcat = sStdConcat & "This is an average fragment of text." next stdConcat_b = timer sbConcat_a = timer set sSbConcat = new StringBuilder for i = 0 to 10000 sSbConcat.append("This is an average fragment of text.") next set sSbConcat = nothing sbConcat_b = timer Response.write("While the required time to concatenate the string with the & operator is " & (stdConcat_b - stdConcat_a) & ", the time consumed by the StringBuilder is " & (sSbConcat_b - sSbConcat_a) & ".") |
Clear the string builder data.
public function reset()
Concatenate the fragments into a string.
public function toString()