Panasonic FP Series Programming Manual page 279

Hide thumbs Also See for FP Series:
Table of Contents

Advertisement

String instructions
REPLACE
REPLACE replaces the characters in the string IN1 with P denoting the first position to be replaced
Description
and L denoting the number of characters to be replaced with the characters specified by IN2. The
result is written into the output variable.
To add an enable input and enable output to the instruction, select [With EN/ENO] from the
"Instructions" pane (LD, FBD or IL editor). To reuse an instruction select "Recently used" from the
context menu or press <Ctrl>+<Shift>+<v> in the programming window.
Availability of REPLACE (see page 1330)
PLC types
 If the strings are longer than the length defined for the input variables
(input_string_1 and input_string_2) in the field "Type", an error occurs
(see Special Internal Relays for Error Handling).
 The number of steps may vary depending on the PLC and parameters
used, see also Table of Code Intensive Instructions in the online help.
(up to 200 steps)
Data types
Data type
STRING
STRING
INT
INT
STRING
Error flags
No.
IEC address
%MX0.900.7
R9007
%MX0.900.8
R9008
In this example, the same POU header is used for all programming languages. For an example
Example
using IL (instruction list), please refer to the online help.
POU header
All input and output variables which are required for programming the function are declared in the
POU header.
Body
In this example constant values are entered directly at the function's input contact pins. However,
you may declare variables in the POU header. The STRING values have to be put in inverted
commas, either in the POU header or at the contact pins. Here the 'c' in the STRING 'MrSpock' has
been replaced with an 'o', yielding 'MrSpook'.
278
Replaces characters
I/O
Function
1st input
input string
2nd input
replacement string
3rd input
the number of characters in the input string to be replaced
4th input
position at which characters begin to be replaced
output
resulting string
Set
permanently
for an instant
If
 input strings are longer than the length
defined for the input variables in the field
"Type"

Advertisement

Table of Contents
loading

Table of Contents