[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] |
Insert one string or dynamic array in another.
Source position: system.fpd line 47
procedure Insert( |
const source: string; |
var S: string; |
const Index: Integer |
); |
const source: DynaArrayType; |
var S: DynArrayType; |
const Index: Integer |
); |
Insert inserts string Source in string S, at position Index, shifting all characters after Index to the right. The resulting string is truncated at 255 characters, if needed. (i.e. for shortstrings)
Index is a 1-based index. if Index is less than 1, the insert of Source happens at the start of the string, as if the value 1 was specified.
If the value of Index is larger than the length of the string S, Source is appended to the string S.
For dynamic arrays, Insert inserts the elements of array Source in array S, at position Index, shifting all elements after Index to the right.
Index is a 0-based index. if Index is less than 0, the insert of Source happens at position0.
If the value of Index is larger than the length of the array S, Source is appended to the array S.
None.
|
Delete elements (characters) from a string or dynamic array. |
|
|
Copy part of a string. |
|
|
Search for substring in a string. |
Program Example33; { Program to demonstrate the Insert function. } Var S : String; begin S:='Free Pascal is difficult to use !'; Insert ('NOT ',S,pos('difficult',S)); writeln (s); end.