System.Insert
From RAD Studio API Documentation
Delphi
procedure Insert(Substr: String; var Dest: String; Index: Integer);
Contents |
Properties
| Type | Visibility | Source | Unit | Parent |
|---|---|---|---|---|
| procedure | public | System.pas | System | System |
Description
Inserts a substring into a string, beginning at a specified position.
In Delphi code, Insert merges Substr into Dest at the position Dest[Index].
Parameters
| Name | Description |
|---|---|
Substr
|
The string to insert in Dest (see below). If this string is empty, Dest is not changed.
|
Dest
|
The string that is changed. |
Index
|
The insertion position. If this value is less than 1, it is set to 1. If it is past the end of Dest, it is set to the length of Dest, turning the operation into an append.
Note: This is a character index (not a byte index). But it must be incremented by 2 to pass over a surrogate pair (see the Unicode specification). When iterating or counting the characters in a Unicode string, a surrogate pair is considered two characters. |
Insert throws an EOutOfMemory exception if it is unable to allocate enough memory to accommodate the new returned string.