11 - 110 11 - 110
MELSEC-Q
11 INSTRUCTIONS AND FUNCTIONS
KLEN
Function
Kanji LENgth
• Returns the number of characters of the character string that includes full-byte characters.
KLEN (<character string expression> [, <function> ])
character string expression
• • • •
Specify the target character string.
Syntax
function
• • • •
Specify what type of character is to be counted.
A=KLEN(A$, 0)
• • • •
Assigns the total number of characters to A treating
full-byte characters as one character.
A B C
10
1 2 3
4
5
6
@
@
@
@ D E F
7
8 9 10
A$
B=KLEN(A$, 1)
• • • •
Counts the number of half-byte characters in
character string A$ and assigns the value to B.
A B C
6
1 2 3
4 5 6
@
@
@
@ D E F
A$
C=KLEN(A$, 2)
• • • •
Counts the number of full-byte characters in
character string A$ and assigns the value to C.
Examples
4
1
2
3
4
DEF
A$ ABC@ @ @ @
• The KLEN function returns the number of characters of the type specified in <function>.
Description
• The following numeric values are specified in <function>. If omitted, it defaults to "0."
0
• • • •
Overall number of characters (full-byte characters are processed as one
character)
1
• • • •
Number of half-byte characters (numbers, alphabet characters, Kana
characters, etc.)
2
• • • •
Full-byte characters (number of full-byte characters)