2-529
2 Instruction Descriptions
NJ-series Instructions Reference Manual (W502)
Text String Instructions
2
REPLACE
REPLACE
The REPLACE instruction replaces part of a text string with another text string.
The REPLACE instruction replaces part of string for replacement In1 with string to insert In2. First the
number of characters specified by L from the position specified by P are deleted from In1. In2 is then
inserted for the deleted characters. A NULL character is placed at the end of replacement result Out.
Instruction Name FB/FUN Graphic expression ST expression
REPLACE Replace String FUN Out:=REPLACE(In1, In2, L,
P);
Variables
Name Meaning I/O Description Valid range Unit Default
In1 String for
replace-
ment
Input
Text string for replacement
Depends on data type.
---
''
In2 Insert
string
Text string to insert
L Number of
characters
Number of characters to
delete
0 to 1985
1
P Replace-
ment start
position
Replacement start position 1 to 1985
Out Replace-
ment result
Output Text string after replacement Depends on data type.
--- ---
Boolean
Bit strings Integers
Real
numbers
Times, durations,
dates, and text strings
BOOL
BYTE
WORD
DWORD
LWORD
USINT
UINT
UDINT
ULINT
SINT
INT
DINT
LINT
REAL
LREAL
TIME
DATE
TOD
DT
STRING
In1 OK
In2 OK
LOK
POK
Out OK
Function
(@)REPLACE
EN ENO
In1 Ou
In2
L
P