>> What i am trying to do is delete an element from an array so that array
>> length is then one less than is was and that i don't have a element that is
>> null.

>> eg delete element 3 from array, array is 6 elements long
>>    do something to the array to make it 5 elements without a null element

> I suspect you'll find a variant array can be redimensioned in one step ...
> As to whether that redimensioning will reallocate within the array I am
> unsure (see the help).

For better performance use a dynamic array (Delphi 4+)

var
    A :array of integer;
    I,N :Integer;
begin
    SetLength(A,10);
    for I := 1 to 4 do A[i-1] := I;

    N := 1;
    // Generalised deletion of an index held in N
    if N<(Length(A)-1) then move(A[N+1],A[N],SizeOf(A[0])*Length(A)-(N+1));
    SetLength(A,length(A)-1);
end;

or something like that...

--
Aaron Scott-Boddendijk
INTAZ Limited
+64 7 838 3371 Voice
+64 7 838 3372 Fax


---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"

Reply via email to