7-222
7.11 String Processing Instructions
7.11.17 Character string data search
INSTR
Program Example
(1) In the following program, the character string data stored in Var_D0 and the following
devices are searched from the 5th character from the left of the character string data stored
in Var_R0 and the following devices when X0 turns ON, and the result is stored to
Var_D100.
[Structured ladder]
[ST]
INSTRP(X0,Var_D0,Var_R0,5,Var_D100);
[Operation]
(2) In the following program, the character string data "AB" is searched from the 3rd character
from the left of the character string data stored in Var_D0 and the following devices when
X1C turns ON, and the result is stored to Var_D100.
[Structured ladder]
[ST]
INSTRP(X0,"AB",Var_D0,3,Var_D100);
[Operation]
43
H
(C)
49
H
(I)
32
H
(2)
33
H
(3)
31
H
(1)
32
H
(2)
43
H
(C)
49
H
(I)
4
D
H
(M)
00
H
"
CI2312CIM"
43
H
(C)
49
H
(I)
32
H
(2)
33
H
(3)
00
H
"
CI23"
S
earches
from
the
5
th
character
0
S
tores
"0" b
ecause
there
are
no
matches
.
N
ot
searche
d
s
i
nce
the
search
start
pos
i
t
i
on
i
s
5
Var
_
D
100
b15
b8b7
b0
b15
b8b7
b0
Var
_
D
0
Var
_R0
S
earches
from
the
3
r
d
character
"A
B
"
31
H
(1)
32
H
(2)
33
H
(3)
34
H
(4)
41
H
(A)
42
H
(
B
)
35
H
(5)
36
H
(6)
41
H
(A)
42
H
(
B
)
00
H
"
1234A
B
56A
B
"
5
th
character
from
the
f
i
rst
character
5
Var
_
D
100
b15
b8b7
b0
Var
_
D
0
Summary of Contents for MELSEC Q Series
Page 1: ...Structured Programming Manual Mitsubishi Programmable Controller QCPU Common Instructions ...
Page 2: ......
Page 14: ...A 12 MEMO ...
Page 340: ...6 178 MEMO MTR ...
Page 708: ...7 368 MEMO ...
Page 776: ...8 68 MEMO ...
Page 796: ...9 20 MEMO ...
Page 804: ...App 8 MEMO ...
Page 812: ...Index 8 MEMO ...
Page 815: ......