3 - 40 3 - 40
MELSEC-Q
3 LET'S CREATE AND EXECUTE A PROGRAM
3.13 Character Processing
3.13.1 Types of characters
There are three basic categories of characters used in BASIC.
• Half-byte characters
(1-byte characters)
• • • • • These are characters that can be input from the
keyboard and include numbers, alphabet characters,
English symbols, Katakana, etc.
• Full-byte characters
(2-byte characters)
• • • • • These include Kanji and Hiragana characters. Full-byte
characters are displayed on the screen using the
space equal to 2 half-byte characters on the screen.
They also requires the amount of space for 2 half-byte
characters when saving to a memory card, FD, etc.
• Control characters
• • • • • Control characters refer to character codes 00h
through 1Fh. These are not normally used, and
produce the same result as when pressing the
key, key, key, key, or Ctrl +
keys on the keyboard. To specify these characters, the
CHR$ function is used.
3.13.2 Half-byte character unit processing
(1) To extract a portion of a character string
There are three functions that can be used to extract a certain portion of a
character string and create a new character string. The following shows an
example:
• The instruction may not
be executed properly if
this is used on a character
string containing full-byte
characters
(Kanji characters).
For details, see (5).
• MID$ has a function to
change a certain portion
of the character string.
For details, see the
description of MID$.
Example
10 A$ = " ABCDEFGHIJ"
20 B$=LEFT$ (A$, 4)
30 PRINT B $
RUN
ABCD
OK
LEFT$(A$, n) creates a new character string by extracting up to the nth
character counting from the left within the character string A$.
Example
10 A$ = " ABCDEFGHIJ"
20 B$=RIGHT $(A$, 4)
30 PRINT B $
RUN
GHIJ
OK
RIGHT$(A$, n) creates a new character string by extracting up to the nth
character counting from the right within the character string A$.
Example
10 A$ = " ABCDEFGHIJ"
20 B$=MID $(A$, 4, 3)
30 PRINT B $
RUN
DEF
OK
MID$(A$, n, m) creates a new character string by extracting m characters from
the nth character counting from the left within the character string A$.
Содержание 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...