count array


[ Related Articles and Replies ] [ DelphiLand FAQ ] [ Delphi Tutorials ]

Posted by delphinewb on December 13, 2001 at 12:51:46:

hi
can somebody tell me the function to count the index of an array so that you can see how many arrays there are.
thx alot
delphi newb


Related Articles and Replies

    Posted by webmaster Guido on December 14, 2001:

    Probably you mean "...how many *elements* there are" :)

    Well, if it's a one-dimensional array, it's easy. From Delphi's help: "The standard function Length returns the number of elements in the array’s first dimension."

    Example: somewhere you defined aNames:
    var aNames: array[1..50] of string;

    Now, you can find the number of elements like this:
    NumberOfElements := Length(aNames);


[ Related Articles and Replies ] [ DelphiLand Discussion Forum ]