32 STRING FUNCTIONS
32.5 Inserting String Data
1953
32
32.5 Inserting String Data
INSERT(_E)
These functions insert a character string into another string, and output the operation result.
■Description, type, data type
■Operation processing
• These functions insert the string input to (s2) into the insertion start position, i.e. the 'n'th character position from the
beginning of the string input to (s1), and output the operation result from (d).
• After the (s2) string is inserted into the (s1) string, 00H, which indicates the end of the (s2) string, is ignored.
• If the string after insertion exceeds 255 bytes, the substring up to the 255th byte will be output.
When (n)=4
Ladder, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
d:=INSERT(s1,s2,n);
[With EN/ENO]
d:=INSERT_E(EN,ENO,s1,s2,n);
Argument Description Type Data type
EN Execution condition (TRUE: Executed, FALSE: Not executed) Input variable BOOL
s1 (IN1), s2 (IN2) Input Input variable ANYSTRING_SINGLE
n (P) Insertion target character start position Input variable INT
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d Output Output variable ANYSTRING_SINGLE
RnCPU
RnENCPU
RnSFCPU RnSFCPURnPCPURnPCPU
(Standard) (Safety)
(Redundant)
(Process)
EN ENO
ds1
s2
n
(s1)
(s2)
(d)
ABC123456DE
45H(E)00H
43H(C)44H(D)
41H(A)42H(B)
123456
35H(5)
00H
36H(6)
33H(3)34H(4)
31H(1)32H(2)
45H(E)00H
36H(6)44H(D)
34H(4)35H(5)
32H(2)33H(3)
43H(C)31H(1)
41H(A)42H(B)
ABCDE
+0
+2
+1
+0
+3
+2
+1
+0
+5
+4
+3
+2
+1
Starting position specified
by (n): 4th character
Lower byteUpper byteLower byteUpper byte
Lower byteUpper byte