2 - 23 2 - 23
MELSEC-Q
2 THE BASICS OF AD51H-BASIC
2.11 Character String Operations
Character strings can be connected using the op.
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 "
" A B " : " A B C "
" A B C " : " A B C D "
41
H
41
H
41
H
42
H
41
H
42
H
41
H
42
H
43
H
41
H
42
H
41
H
42
H
43
H
43
H
44
H
The result is "AA" < "AB"
The result is "AB" < "ABC"
The result is "ABC" < "ABCD"
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.