String Concatenation Component


I wrote this component - StrCat.Catter - because string concatenation in Visual Basic (Script) has poor performance characteristics. I found that code like this:

  Dim rs
  Set rs = ExecuteSql("SELECT Username FROM Users")

  Dim some_str
  some_str = ""

  do until rs.EOF
    some_str = some_str & rs(0) & "<br>" & vbCrLf

  Response.Write some_str

performed very poorly. The code took a long time to execute, during which time the processor was totally saturated. I found articles on MSDN stating that this type of code was a bad idea, and I've heard that this type of concatenation results in run times that are proportional to the square of the number of concatenations.

You might also like...



Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Every language has an optimization operator. In C++ that operator is ‘//’”