Difference between revisions of "TIAInsert"

From SCAR Divi Manual
Jump to: navigation, search
(Created page with "==Definition== <source lang="scar" lines="false"> function TIAInsert(var TIA: TIntArray; const Index, Int: Integer): Integer; </source> ==Availability== SCAR Divi 3.34 > Current...")
(No difference)

Revision as of 17:36, 23 April 2012

Definition

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

Availability

SCAR Divi 3.34 > Current

Description

Inserts the given integer Int at an index Index in the given TIntArray TIA. 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
  TIA: TIntArray;

begin
  TIA := [0, 1, 3];
  WriteLn(TIAInsert(TIA, 1, 8)); 
  WriteLn(TIAInsert(TIA, -500, 8)); 
  WriteLn(TIAInsert(TIA, 500, 8));
  WriteLn(TIAToStr(TIA));
end.

Output:

1
0
5
8,0,8,1,3,8

See Also