ENO
REPLACE
Parameter
IN1
IN2
L
P
OUT
REPLACE (Replace substring) replaces L characters in the string parameter IN1.
Replacement starts at string IN1 character position P (inclusive), with replacement
characters coming from the string parameter IN2.
● If parameter L is equal to zero, then the string IN2 is inserted at position P of string IN1
● If P is equal to one, then the first L characters of string IN1 are replaced with string IN2
The following table shows the condition codes for the instruction.
ENO
1
0
FIND
Parameter
IN1
IN2
OUT
FIND (Find substring) provides the character position of the substring or character specified
by IN2 within the string IN1. The search starts on the left. The character position of the first
S7-1200 Programmable controller
System Manual, 11/2009, A5E02486680-02
Condition
Resulting string after insertion is larger than
maximum length of OUT string
Parameter
Data type
type
IN
String
IN
String
IN
Int
IN
Int
OUT
String
without deleting any characters from string IN1.
characters.
Condition
No errors detected
P is greater than length of IN1
P points within IN1, but fewer than L characters
remain in IN1
L is less than 0, or P is less than or equal to 0
Resulting string after replacement is larger than
maximum length of OUT string
Parameter
Data type
type
IN
String
IN
String
OUT
Int
OUT
Resulting string characters are copied
until the maximum length of OUT is
reached
Description
Input string
String of replacement characters
Number of characters to replace
Position of first character to be replaced
Result string
OUT
Valid characters
IN2 is concatenated with IN1
immediately following the last IN1
character
IN2 replaces the end characters of IN1
beginning at position P
Current length is set to 0
Resulting string characters are copied
until the maximum length of OUT is
reached
Description
Search inside this string
Search for this string
Character position in string IN1 of the first search match
Programming instructions
6.2 Extended instructions
149