System.Insert
Delphi
procedure Insert(Source: <string or dynamic array>; var Dest: <string or dynamic array>; Index: Integer);
Contents
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
procedure | public | System.pas | System | System |
Description
Inserts a substring into a string (or inserts a dynamic array into a dynamic array), beginning at a specified position.
In Delphi code, Insert merges Source
into Dest
at the position Dest[Index]
.
Parameters
Name | Description |
---|---|
Source
|
The string or array elements to insert in Dest . If Source is empty, Dest is not changed.
|
Dest
|
The destination string or array, which is changed if the operation succeeds. |
Index
|
The insertion position:
|
Insert throws an EOutOfMemory exception if it is unable to allocate enough memory to accommodate the new returned string or array.
Dynamic Array Example
var
A: array of integer;
begin
...
A:=[1,2,3,4];
Insert(5,A,2); // A will become [1,2,5,3,4]
...
end;