String instructions
276
Part II IEC Instructions
INSERT
Insert characters
To add an enable input and enable output to the instruction, select [With EN/ENO] from the
"Instructions" pane (LD, FBD or IL editor). To reuse an instruction select "Recently used" from the
context menu or press <Ctrl>+<Shift>+<v> in the programming window.
PLC types
Availability of INSERT (see page 1327)
If the strings are longer than the length defined for the input variables
(input_string_1 and input_string_2) in the field "Type", an error occurs
(see Special Internal Relays for Error Handling).
The number of steps may vary depending on the PLC and parameters
used, see also Table of Code Intensive Instructions in the online help.
(up to 200 steps)
Data type I/O Function
STRING 1st input input string
STRING 2nd input string to be inserted into input string
INT 3rd input position at which string is inserted
STRING output result string
No. IEC address Set If
R9007 %MX0.900.7 permanently
R9008 %MX0.900.8 for an instant
input strings are longer than the length
defined for the input variables in the field
"Type"
Description
INSERT inserts the string IN2 into the string IN1 beginning after the character position P, where 0
denotes the beginning of the string, 1 the position after the first string character, etc. The result is
written into the output variable.
Data types
Error flags
Example
In this example, the same POU header is used for all programming languages. For an example
using IL (instruction list), please refer to the online help.
POU header
All input and output variables used for programming this function have been declared in the POU
header.