TEAInsert

From SCAR Divi Manual
Revision as of 13:45, 26 November 2012 by Freddy (talk | contribs) (Created page with "==Definition== <source lang="scar" lines="false"> function TEAInsert(var TEA: TExtArray; const Index: Integer; const Ext: Extended): Integer; </source> ==Availability== SCAR ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Definition

function TEAInsert(var TEA: TExtArray; const Index: Integer; const Ext: Extended): Integer;

Availability

SCAR Divi 3.37 > Current

Description

Inserts the given extended Ext at an index Index in the given TExtArray TEA. 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
  TEA: TExtArray;

begin
  TEA := [0.1, 1.2, 3.3];
  WriteLn(TEAInsert(TEA, 1, 8.5)); 
  WriteLn(TEAInsert(TEA, -500, 8.2)); 
  WriteLn(TEAInsert(TEA, 500, 8.8));
  WriteLn(TEAToStr(TEA));
end.

Output:

1
0
5
8.2,0.1,8.5,1.2,3.3,8.8

See Also