Replacement Of Character String From Specified Position - Mitsubishi Electric MELSEC Q Series Programming Manual

Structured text
Hide thumbs Also See for MELSEC Q Series:
Table of Contents

Advertisement

6 IEC FUNCTIONS

6.10.8 Replacement of character string from specified position

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
Function definition
6 - 76
STRING REPLACE( STRING S1, STRING S2, INT n, INT POS );
Argument
Argument Name
IN/OUT
S1
IN
S2
IN
n
IN
POS
IN
Return value
Return Value
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 replacement + 1 character
as the data area that will store the character string data after replacement.
Example of use
Argument Type
STRING
w_Str3 :=
REPLACE( w_Str1,w_Str2,
w_Word1,
w_Word2 );
BOOL REPLACE_E( BOOL EN, STRING S1, STRING S2, INT n, INT POS, STRING
D1 );
Argument
Argument Name
IN/OUT
EN
IN
S1
IN
S2
IN
n
IN
POS
IN
D1
OUT
Remarks: Secure the area of the number of characters after replacement + 1 character
as the data area that will store the character string data after replacement.
Return value
Return Value
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 ) ;
Data to be replaced (character string data)
Data that will replace (character string data)
Number of characters to be replaced (BIN 16-bit data)
Replacement start position (BIN 16-bit data)
ST Program
Conversion Result
LD
$MOV
MOV
MOV
MIDW
Execution condition (Function is executed only when the result is TRUE)
Data to be replaced (character string data)
Data that will replace (character string data)
Number of characters to be replaced (BIN 16-bit data)
Replacement start position (BIN 16-bit data)
Replacement result (character string data)
REPLACE
REPLACE_E
Description
Description
Used Instruction
SM400
LD,$MOV,MOV,
w_Str1
w_Str3
MIDW
w_Word1
D10239
w_Word2
D10238
w_Str2
w_Str3
D10238
Description
Description
*)
*)
*)
*)
6 - 76

Advertisement

Table of Contents
loading

This manual is also suitable for:

Melsec l series

Table of Contents