[fpc-pascal] Pascal arrays vs TStringList.DelimitedText

Paul Nicholls paulfnicholls at gmail.com
Fri Mar 20 06:31:23 CET 2009

----- Original Message ----- 
From: "Francisco Reyes" <lists at stringsutils.com>
To: "FreePascal list" <fpc-pascal at lists.freepascal.org>
Sent: Friday, March 20, 2009 2:32 PM
Subject: [fpc-pascal] Pascal arrays vs TStringList.DelimitedText

> Getting back to Pascal.. Aren't pascal arrays 1 based?
> As I get myself re-acquainted with pascal I am working on a small open 
> source utility. Bumped into something that confused me.. It seems 
> TStringList.DelimitedText produces an array that starts at zero, but from 
> what I can tell regular arrays start at 1.
> Is there a list anywhere of which classes in the FCL use arrays that start 
> at zero?
> Tried reading the Tstringlist documentation and the beginning of the 
> classes unit for any indicator of arrays in that unit starting at zero, 
> but did not see any. Did I miss it?

Hi Francisco, regular arrays can start at whatever index you want:

    MyArray1 : Array[1..3] Of Integer;
    MyArray2 : Array[-3..21] Of String;

Dynamic Arrays :

    MyDynamicArray : Array Of Integer;

These always start with a zero index.

TStringList and similar classes use a zero index too.

I don't know if there is any list like you want though...

More information about the fpc-pascal mailing list