Character String Operations - Mitsubishi QD51 Programming Manual

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

Advertisement

2 THE BASICS OF AD51H-BASIC

2.11 Character String Operations

2 - 23
Character strings can be connected using the operator +.
Example
10 A$=" FILE":B$=" NAME"
20 PRINT A$+B$
30 PRINT" NEW"+A$+B$
RUN
FILENAME
NEWFILENAME
OK
Also, relational operations can be performed on character strings using the relational
operators shown below.
= < > < > <= >=
In character string comparisons, the characters in two character strings are compared
one by one (1 byte) in sequence from the beginning, by assuming the character code
(Appendix 4.1) as a value.
If the character codes for both character strings are completely identical, the character
strings are considered equal. However, if there is even one different byte, the character
string with the lesser character code is considered to be the lesser of the two.
Also, if one of the character strings ends during a comparison, the shorter of the two
will be considered to be the lesser of the two.
The spaces in the beginning or end of the character string are also subject to
comparison.
Example
"A A "
:
" A B "
41
41
41
42
H
H
H
H
" A B "
:
" A B C "
43
41
42
41
42
H
H
H
H
H
" A B C "
:
" A B C D"
41
42
43
42
43
41
H
H
H
H
H
As shown above, character string comparison can be used to sort character strings in
alphabetical order. All character string constants in expressions to be compared must
be enclosed in parentheses.
The result is "AA" < "AB"
The result is "AB" < "ABC"
The result is "ABC" < "ABCD"
44
H
H
MELSEC-Q
2 - 23

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents