Mitsubishi QD51 Programming Manual page 534

Logic controller
Hide thumbs Also See for QD51:
Table of Contents

Advertisement

11 INSTRUCTIONS AND FUNCTIONS
RIGHT$
Function
• Extracts a character string consisting of the specified number of characters from the right
end of a character string and assigns it to a variable.
RIGHT$(<character string expression>, <numeric expression>)
Syntax
character string expression
numeric expression
A$=RIGHT$(B$, 4)
Examples
• The RIGHT$ function extracts a character string consisting of the specified number of
Description
characters from the right end of the string and assigns it to a variable.
• <numeric expression> indicates the length of the character string to be extracted.
• If the value of <numeric expression> is 0, a null character string (" ") is returned.
If a value greater than 255 is specified, an "Illegal function call" error occurs.
• If the value of <numeric expression> is equal to or greater than the length in <character
string expression>, the entire <character string expression> is returned.
• If a full-byte character is included in <character string expression>, it is counted as two
characters.
See Section 3.13.1 (5) for details.
Program Example
10 ' This program extracts seven characters from the right end of a character string
20 A$="Sequence program"
30 B$=RIGHT$(A$,7)
50 PRINT "Seven characters from the right--->";B$
60 END
RUN
Seven characters from the right--->program
OK
11 - 364
RIGHT$
• • • •
• • • •
• • • •
B$
A
B
C
D
REMARK
See the LEFT$, MID$ (1) and MID$ (2) functions, and Section 3.13.2.
Specify the character string that is to be processed.
Specify the number of characters to be extracted.
Extracts four characters from the right end of B$ and
assign them to A$.
E
F
G
H
4
3
2
1
:
'Defines a character string
:
'Specifies to extract seven characters from
the right
:
'Displays the extracted character string
MELSEC-Q
A$
E
F
G
H
11 - 364

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents