SmartPascal
Insert
Procedure
Insert a string into another string System unit
 procedure Insert ( const InsertStr : string; var TargetStr : string; Position : Integer ) ;
Description
The Insert procedure inserts one string, InsertStr into another string, TargetStr at the given Position.
 
The TargetStr string characters from the Position character are moved right to make way for the InsertStr string.
 
The length of TargetStr is now the sum of the length of the two strings.
 
To insert into the start of TargetStr, set Position to 1 or less.
 
To append to the end of TargetStr, set Position after the last character of TargetStr.
Notes
The first character of a string is at position 1

Arrays start at index 0.
Related commands
AnsiReplaceStr Replaces a part of one string with another
Concat Concatenates one or more strings into one string
Copy Create a copy of part of a string or an array
Delete Delete a section of characters from a string
Move Copy bytes of data from a source to a destination
StringOfChar Creates a string with one character repeated many times
StringReplace Replace one or more substrings found within a string
StuffString Replaces a part of one string with another
WrapText Add line feeds into a string to simulate word wrap
 
Example code : Inserting into the middle of a string
var
  Target : string;
begin
  Target := '12345678';
  Insert('-+-', Target, 3);
  ShowMessage('Target : '+Target);
end;
Show full unit code
   Target : 12-+-345678