388
7 APPLICATION INSTRUCTION
7.6 Character string operation instruction
Detecting a character string length
LEN(P)
These instructions detect the length of the character string specified by (s), and store the length in the device specified by (d)
and later.
These instructions handle data stored in the device specified by (s) to the device storing 00H as a character string.
*1 The LEN instruction is not supported by the ST language. Use LEN of the standard function.
Page 814 LEN(_E)
■Descriptions, ranges, and data types
■Applicable devices
*1 T, ST, C cannot be used.
• These instructions detect the length of the character string specified by (s), and store the length in the device specified by
(d) and later.
• These instructions handle data stored in the device specified by (s) to the device storing 00H as a character string.
When "ABCDEFGHI" is stored in (s) and later
Ladder diagram Structured text
*1
ENO:=LENP(EN,s,d);
Operand Description Range Data type Data type (label)
(s) Character string or head device number storing a character string Character string Character string
(d) Device number storing the detected character string length 16-bit signed binary ANY16
Operand Bit Word Double word Indirect
specification
Constant Others
X, Y, M, L,
SM, F, B, SB
U\G T, ST,
C, LC
T, ST, C, D,
W, SD, SW, R
U\G Z LC LZ K, H E $
(s)
*1
(d)
00H
b15 b0b7b8
b15 b0
(d)
(s)
(s)+1
(s)+2
(s)+n
1st character2nd character
3rd character4th character
5th character6th character
"n"th character
Indicates the end of the character string.
Character string length
b15 b0b7b8
b15 b0
(d)
(s)
(s)+1
(s)+2
(s)+3
(s)+4
41H (A)42H (B)
43H (C)44H (D)
45H (E)46H (F)
47H (G)48H (H)
49H (I)00H
"ABCDEFGHI"
9