11 - 118 11 - 118
MELSEC-Q
11 INSTRUCTIONS AND FUNCTIONS
KTYPE
Function
Kanji TYPE
• Returns the character type of the specified position within the character string that includes
full-byte characters.
KTYPE ( <character string expression> , <numeric expression> )
character string expression
• • • •
Specify the applicable character string for the
process
Syntax
numeric expression
Specify the character position within the character
string in which the type is verified.
Examples
A=KTYPE(A$,4)
• • • •
Counts the characters from the left of A$ and
assigns the character type of the fourth character to
A.
AB @ @ @ @
A$
1
A
1 2 3
4
Full-byte character
• The KTYPE function returns the character type of the character corresponding to the
number of characters specified by <numeric expression> in <character string expression>
counting from the left as follows. Full-byte characters are counted as one character.
0
• • • •
Half-byte characters (numbers, alphabets, Kana characters, etc.)
1
• • • •
Full-byte characters (Kanji, etc.)
Description
• If the value of <numeric expression> is 0 or greater than the number of characters in the
character string, an “Illegal function call” error will be generated. This error will also be
generated when the <character string expression> is “ “ (empty character expression).
Program Example
10 ' Checks the character type
20 A$="@@@@@@@"
:
' Defines the character string
30 A=KTYPE(A$,6)
: ' Character type of the 6th character from
the left
50 PRINT "Character type is";A
60 END
RUN
Character type is 1
OK
REMARK
See the KINSTR, KLEN and KMID$ functions.
Содержание 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...