5.8 Standard Character String Functions
192
FXCPU Structured Programming Manual
(Application Functions)
5.8.5 REPLACE(_E)
Outline
This function replaces a character string.
1. Format
*1. Output variable
2. Set data
In explanation of functions, I/O variables inside ( ) are described.
FX3U(C) FX3G FX2N(C) FX1N(C) FX1S
FX
U
/FX
2C
FX0N FX0(S)
Function name
Expression in each language
Structured ladder ST
REPLACE
REPLACE(_IN1,_IN2,_L,_P);
Example:
Label 3:=
REPLACE(Label 1,Label 2,
D20,D30);
REPLACE_E
REPLACE_E(EN,_IN1,_IN2,
_L,_P,Output label);
Example:
REPLACE_E(X000,Label 1,
Label 2,D20,D30,Label 3);
Variable Description Data type
Input
variable
EN Execution condition Bit
_IN1 ( )
Head word device which stores a character string to be replaced String
_IN2 ( )
Head word device which stores a replacement character string String
_L ( )
Word device which stores the number of characters to be replaced Word [signed]
_P ( )
Word device which stores the head character position to be
replaced in a character string to be replaced
Word [signed]
Output
variable
ENO Execution status Bit
*1 ( )
Head word device which will store a character string obtained by
replacement
String
REPLACE
*1
Label 3Label 1 _IN1
_IN2
Label 2
D20
_L
_P
D30
REPLACE_E
EN ENO
*1
Label 3
X000
Label 1
_IN1
_IN2
Label 2
D20
_L
_P
D30
s1
s2
n1
n2
d