Replace (Replace Characters In A Character String) Instruction; S7-1200 Programmable Controller - Siemens S7-1200 System Manual

Hide thumbs Also See for S7-1200:
Table of Contents

Advertisement

Extended instructions
8.2 String and character
8.2.4.7

REPLACE (Replace characters in a character string) instruction

Table 8- 64
Replace substring instruction
LAD / FBD
SCL
out := REPLACE(
Table 8- 65
Data types for the parameters
Parameter and type
IN1
IN
IN2
IN
L
IN
P
IN
OUT
OUT
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.
Table 8- 66
ENO status
ENO
Condition
1
No errors detected
0
P is greater than length of IN1
P points within IN1, but fewer than L characters remain in IN1
Resulting string after replacement is larger than maximum length of
OUT string
Maximum length of IN1 is 0
L is less than 0, or P is less than or equal to 0
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
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
312
in1:=_string_in_,
in2:=_string_in_,
L:=_int_in_,
p:=_int_in);
Data type
String
String
Int
Int
String
Description
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.
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
Resulting string characters are copied
until the maximum length of OUT is
reached
IN2 characters are copied to OUT
Current length is set to 0

S7-1200 Programmable controller

System Manual, 03/2014, A5E02486680-AG

Advertisement

Table of Contents
loading

Table of Contents