> > But I mean if you are doing things at different times in the program: > > > > for i := 1 to 1000 > > DoSomestuff > > s:= string + string; > > DoOtherStuff > > s:= string + string; > > > > in other words.. not one big concatenation at once such as: > > > > string.concatenate(string1, string2, string3, string4); > > > > The only way I saw it possible in my mind was through a special string buffer > > type (or hey, even a stringbuffer class if not a true system type). > > > > With TStrings.concatenate did you mean an all at once concatenation? > > All strings in the list are concatenated in one step, regardless of > when they were added to the list: > > Sl:=TStringList.Create; > for i := 1 to 10000000 do > begin > DoSomestuff; > SL.Add(SomeString); > DoOtherStuff; > SL.Add(SomeOtherString); > end; > Result:=SL.Concatenate; // This can be optimized to 1 getmem call. > > Michael.
I suppose this is sort of like SetTextBuff for stringlist :) And how about if you don't have any line delimiter? i.e. a string buffer with no CRLF or LF.. does the TStrings type allow to disable the line delimiter? _________________________________________________________________ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives