Contents | Prev | Next

7.4.29 The insert procedure

Description

The insert procedure either inserts a string into another string or inserts a value into a list.

Parameter

  1. The first parameter is an expression whose value is to be inserted into the string or list.
  2. The second parameter is a reference to the string variable or the list variable into which the value is to be inserted.
  3. The third parameter is an expression of integral type, and is the position in the string or list where the value is to be inserted. If this parameter is not supplied then the value is inserted at the end of the string or list.

Example

Here are some examples using the insert procedure with strings:

Assuming that x is a string variable then after:

   x := "ABC";
   insert('DEF', x); //insert 'DEF' at the end of "x"

x will contain 'ABCDEF', and after:

   x := 'ABFGHI';
   insert('CDE', x, 3); //insert 'CDE' at the third position

x will contain 'ABCDEFGHI'.

Portability

Operating Systems: All
Standard Pascal: No

Contents | Prev | Next