TPAInsert

From SCAR Divi Manual
Jump to: navigation, search

Definition

function TIAInsert(var TIA: TIntArray; const Index, Int: Integer): Integer;

Availability

SCAR Divi 3.34 > Current

Description

Inserts the given point Point at an index Index in the given TPointArray TPA. If Index is smaller than 0 the function will append the element at the front of the array. If Index is larger than or equal to the length of the array, the item will be appended to the back of the array. The index of the inserted element is returned.

Example

var
  TPA: TPointArray;
 
begin
  TPA := [Point(0, 0), Point(1, 1), Point(3, 3)];
  WriteLn(TPAInsert(TPA, 1, Point(4, 4)));        
  WriteLn(TPAInsert(TPA, -500, Point(4, 4)));
  WriteLn(TPAInsert(TPA, 500, Point(4, 4)));
  WriteLn(TPAToStr(TPA));
end.

Output:

1
0
5
(4,4);(0,0);(4,4);(1,1);(3,3);(4,4)

See Also