Link to home
Create AccountLog in
Avatar of DavidBirch2dotCom
DavidBirch2dotCom

asked on

TStringLists - easy

Hi a couple of quick Q's about TStringLists...

looking @ http://www.delphibasics.co.uk/RTL.asp?Name=TStringList

"Capacity property
Set or get the current capacity of the string list. You would manage this capacity for performance reasons. "

how & why - example please I would like to speed this up as much as possible and reduce memory use

also

If i have two StringList's and I go  stringList1:= stringlist2; I have found that the contents of the list is lost ? is there a simple way to transfer between lists without itinerating?

David
SOLUTION
Avatar of esoftbg
esoftbg
Flag of Bulgaria image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
In your case:
  stringList1.Assign(stringlist2);
Avatar of DavidBirch2dotCom
DavidBirch2dotCom

ASKER

Thanks esoftbg, thats that one, how do you use the capacity property?
To be honest, I never did use the capacity property .... I just did read the help about this property, but you probably did read it too, so .... May be someone else have an opinion about ....
ASKER CERTIFIED SOLUTION
Avatar of TheRealLoki
TheRealLoki
Flag of New Zealand image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Using "insert" instead of "add" does a major speed increase if working with alot of items.

  st.Insert(st.count, 'item');

is alot faster than

  st.Add('item');

which does the same thing. Weird huh ^^
nm, seems not to be the case in the newer versions of Delphi.

Just ignore me ^^
Thanks all