INSERT¶
Provided by standard.lib.
INSERT inserts a string into another string at a defined point.
The input variables STR1 and STR2 are type STRING, POS is type INT and the return value of the function is type STRING.
INSERT(STR1, STR2, POS) means: insert STR2 into STR1 after position POS.
Example in IL
LD ‘SUSI’
INSERT ‘XY’,2
ST VarSTRING1 (* Result is ‘SUXYSI’ *)
Example in FBD
Example in ST
VarSTRING1 := INSERT (‘SUSI’,’XY’,2);
Note
String functions are not “thread safe”: When using tasks, string functions may only be used in a single task. If the same function is used in different tasks, there is a danger of overwriting.