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.
Содержание A1SD51S
Страница 183: ...11 13 11 13 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS RUN Before swap A 0 H924 A 1 H1159 After swap A 0 H1159 A 1 H924 OK...
Страница 331: ...11 161 11 161 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the CON ON OFF STOP and ZOPEN functions and Section 7 4...
Страница 557: ...11 387 11 387 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the CHR SPACE and SPC functions...
Страница 629: ...11 459 11 459 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the ZOPEN ZSEND and ZCNTL instructions and Section 7 3 4...
Страница 645: ...11 475 11 475 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the ZEVENT ZSIGNAL and DEF ZEVENT instructions...