101BExtended instructions
8.2 String and character
S7-1200 Programmable controller
258
System Manual, 11/2011, A5E02486680-05
ENO
Condition
OUT
Resulting string after insertion is larger than maximum length of
OUT string
Resulting string characters are copied
until the maximum length of OUT is
reached
Current length of IN1 exceeds maximum length of IN1, current
length of IN2 exceeds maximum length of IN2, or current length of
OUT exceeds maximum length of OUT (invalid string)
Maximum length of IN1, IN2 or OUT does not fit within allocated
memory range
Maximum length of IN1 or IN2 is 255, or maximum length of OUT is
0 or 255
Current length is set to 0
8.2.4.6
REPLACE
Table 8- 65 Replace substring instruction
LAD / FBD
SCL
Description
out := REPLACE(
in1:=_string_in_,
in2:=_string_in_,
L:=_int_in_,
p:=_int_in);
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.
Table 8- 66 Data types for the parameters
Parameter and type
Data type
Description
IN1
IN
String
Input string
IN2
IN
String
String of replacement characters
L
IN
Int
Number of characters to replace
P
IN
Int
Position of first character to be replaced
OUT
OUT
String
Result string
If parameter L is equal to zero, then the string IN2 is inserted at position P of string IN1
without deleting any characters from string IN1.
If P is equal to one, then the first L characters of string IN1 are replaced with string IN2
characters.