3 - 44 3 - 44
MELSEC-Q
3 LET'S CREATE AND EXECUTE A PROGRAM
3.13.3 Processes in full-Byte character increments
As shown in (5) in Section 3.13.2, a single full-byte character (Kanji character) is
considered as taking up the space equivalent to two single-byte characters in the
character processing in half-byte character increments. However, in the processing of
full-byte character increments, full-byte characters are also considered one character
when processed.
(1) Extracting a portion of a character string
The KMID$ function is similar to the MID$ function ((1) in Section 3.13.1)
explained in the processing of half-byte character increments. KMID$(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$. When this is performed, full-
byte characters are considered one character, and the result is as follows.
Example
10 A$= " A B C
20 PRINT MID$(A$, 8, 4)
30 PRINT KMID$(A$, 6, 2)
40 END
RUN
@@
MID$
KMID$
A
B
C
@
@
@
@
D
E
F
2
1
3
5
4
6 7 8 9
11
10
12
13
14
1
2
3
4
5
6
7
8
9
10
D E F"
@ @ @ @
OK
@@
(2) Finding the length of a character string
The KLEN function is used to find the length of a character string containing full-
byte characters. The KLEN function has many functions, and each function is
specified by integers 0, 1, or 2.
Example
10 A$= " A B C
20 PRINT KLEN(A$,0)
30 PRINT KLEN(A$,1)
40 PRINT KLEN(A$,2)
RUN
10
6
4
OK
Displays the number of half-byte
characters in A$.
Displays the number of full-byte characters in A$.
Displays the number of characters
in the entire
A$ character string. Full-byte characters are
counted as one character when this is processed.
D E F"
@ @ @ @
Содержание 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...