6 - 76 6 - 76
6 IEC FUNCTIONS
6.10.8 Replacement of character string from specified position REPLACE
REPLACE_E
n characters of character string data starting at the specified position of the specified character string data is
replaced by the specified character string.
Function definition
STRING REPLACE( STRING S1, STRING S2, INT n, INT POS );
Argument
Argument Name
IN/OUT
Description
S1
IN
Data to be replaced (character string data)
S2
IN
Data that will replace (character string data)
n
IN
Number of characters to be replaced (BIN 16-bit data)
POS
IN
Replacement start position (BIN 16-bit data)
Return value
Return Value
Description
STRING
Replacement result (character string data)
Remarks: This function cannot be used with the Basic model QCPU.
Secure the area of the number of characters after repla 1 character
as the data area that will store the character string data after replacement.
Example of use
Argument Type
ST Program
Conversion Result
Used Instruction
STRING w_Str3
:=
REPLACE( w_Str1,w_Str2,
w_Word1,
w_Word2 );
LD SM400
$MOV w_Str1 w_Str3
MOV w_Word1
D10239
MOV w_Word2
D10238
MIDW w_Str2 w_Str3
D10238
LD,$MOV,MOV,
MIDW
Function definition
BOOL REPLACE_E( BOOL EN, STRING S1, STRING S2, INT n, INT POS, STRING
D1 );
Argument
Argument Name
IN/OUT
Description
EN
IN
Execution condition (Function is executed only when the result is TRUE)
S1
IN
Data to be replaced (character string data)
S2
IN
Data that will replace (character string data)
n
IN
Number of characters to be replaced (BIN 16-bit data)
POS
IN
Replacement start position (BIN 16-bit data)
D1
OUT
Replacement result (character string data)
Remarks: Secure the area of the number of characters after repla 1 character
as the data area that will store the character string data after replacement.
Return value
Return Value
Description
BOOL Execution
condition
Example of use
(*
(*
(*
(*
When execution condition X0 turns ON, the character string data of the
number of characters specified in iData1, starting at iData2 from the head of
the character string data in sData1, is replaced by the character string data in
sData2, and the result is stored into Result.
M0 := REPLACE_E( X0, sData1, sData2, iData1, iData2, Result ) ;
*)
*)
*)
*)
Содержание MELSEC L series
Страница 1: ...Programming Manual Structured Text ...
Страница 2: ......
Страница 73: ...4 33 4 33 4 ST PROGRAM EXPRESSIONS MEMO ...
Страница 297: ......