----- Original Message ----- From: "Francisco Reyes" <li...@stringsutils.com>
To: "FreePascal list" <fpc-pascal@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:

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

Dynamic Arrays :

Var
   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...
cheers,
Paul
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to