Recent

Author Topic: TStringList Question  (Read 590 times)

nugax

  • Full Member
  • ***
  • Posts: 221
TStringList Question
« on: April 29, 2022, 07:36:33 pm »
Do TStringList start at 0 or 1?
-Nugax

wp

  • Hero Member
  • *****
  • Posts: 9718
Re: TStringList Question
« Reply #1 on: April 29, 2022, 07:59:30 pm »
0
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

Bart

  • Hero Member
  • *****
  • Posts: 4704
    • Bart en Mariska's Webstek
Re: TStringList Question
« Reply #2 on: April 29, 2022, 10:28:06 pm »
but only if instantiated...

mas steindorff

  • Hero Member
  • *****
  • Posts: 500
Re: TStringList Question
« Reply #3 on: May 19, 2022, 07:56:39 pm »
all Tstring, Tlist, Tcontainer, Tmemo.lines,... and many more objects/class start with index 0 and run to (Txx.count-1).  That makes it consistent across predefined objects/classes so you do not need to be an expert to use them.  learn the basics of array handling for one and your good for the others.
I look for a .count and .items[] elements in any class/object I have not used before  and if found, I know the basic indexes needed to step though the list.
windows 7/10 - laz 2.0 / 1.2.6 general releases

 

TinyPortal © 2005-2018