Re: [fpc-pascal] string concatenation speed

2005-06-21 Thread Luiz Américo
Michael Van Canneyt wrote: Len:=0; For I:=X to Y do Inc(Len,Length(L[i])); // S string, L list. SetLength(S,Len); P:=1; For I:=X to Y do begin T:=L[i]; Len:=Length(T); Move(T[1],S[P],Len); inc(P,Len) end; This is the behavior you get using TStrings.Text

Re: [fpc-pascal] string concatenation speed

2005-06-21 Thread Marc Santhoff
Am Dienstag, den 21.06.2005, 21:19 +0200 schrieb Leonhard Holz: > Hi, Hi Leo, > > > > if (sl[4] <> '') then > > if ((sl[4][1] = '"') AND (sl[4][length(sl[4])] = '"')) > > then BaseColor := copy(sl[4],2,length(sl[4])-2) else > > BaseColor := > > sl[4]; > > You ca

Re: [fpc-pascal] string concatenation speed

2005-06-21 Thread Leonhard Holz
Hi, if (sl[4] <> '') then if ((sl[4][1] = '"') AND (sl[4][length(sl[4])] = '"')) then BaseColor := copy(sl[4],2,length(sl[4])-2) else BaseColor := sl[4]; You can tweak this a little by storing sl[4] and length(sl[4]) in local vars, but the whole appro

Re: [fpc-pascal] string concatenation speed

2005-06-21 Thread Marc Santhoff
Am Dienstag, den 21.06.2005, 19:46 +0200 schrieb Michael Van Canneyt: > > On Tue, 21 Jun 2005, Marc Santhoff wrote: > > > Hi, > > > > in an application of mine occurs a lot of string separation and > > re-concatenation. Since it is using masses of ANSI strings this is some > > performance proble

Re: [fpc-pascal] string concatenation speed

2005-06-21 Thread Marco van de Voort
> > So in general reserving buffer space and copying all string in and > finally setting the length would be the way to go here, if I understand > correctly. Yes, and avoid repeated use of stringlist[x]. First assign to a local var, then use for length() and normal use, as Michael already noted.

Re: [fpc-pascal] string concatenation speed

2005-06-21 Thread Marc Santhoff
Am Dienstag, den 21.06.2005, 19:21 +0200 schrieb Marco van de Voort: > > in an application of mine occurs a lot of string separation and > > re-concatenation. Since it is using masses of ANSI strings this is some > > performance problem. > > > > The strings get stored and loaded from TStringList'

Re: [fpc-pascal] string concatenation speed

2005-06-21 Thread Michael Van Canneyt
On Tue, 21 Jun 2005, Marc Santhoff wrote: > Hi, > > in an application of mine occurs a lot of string separation and > re-concatenation. Since it is using masses of ANSI strings this is some > performance problem. > > The strings get stored and loaded from TStringList's and concatenated > by s

Re: [fpc-pascal] string concatenation speed

2005-06-21 Thread Marco van de Voort
> in an application of mine occurs a lot of string separation and > re-concatenation. Since it is using masses of ANSI strings this is some > performance problem. > > The strings get stored and loaded from TStringList's and concatenated > by simply using '+' and separated with the function copy()