11 - 112 11 - 112
MELSEC-Q
11 INSTRUCTIONS AND FUNCTIONS
KMID$
Function
Kanji MiDdle $
• Returns the partial character string that starts at the specified position of a character string
that includes full-byte characters.
KMID$ ( <character string expression> , <numeric expression 1> [, <numeric expression 2> ])
character string expression
• • • •
Specify the applicable character string for
processing.
numeric expression 1
• • • •
Specify the number of characters in the applicable
character expression where extraction starts.
Syntax
numeric expression 2
• • • •
Specify the number of characters that are extracted
from the position specified in <numeric expression 1>.
Examples
A$=KMID$(B$, 3, 2)
• • • •
Extracts two characters starting with the third
character from the left of B$ and assigns it in A$.
B$
1
1
2
3
4
5
6
-
@
@
@
@
A$
@
@
Description
• The KMID$ function returns the character string of the number of characters specified in
<numeric expression 2> starting from the character in <numeric expression 1> counting
from the left of <character string expression>. Full-byte characters are counted as one
character.
• <numeric expression 1> and <numeric expression 2> are specified in a range between 1
and 255.
• If the number of characters in <character string expression> is less than <numeric
expression 1>, “ ” (empty character string) is returned.
• If <numeric expression 2> is omitted, or if the number of characters to the right of the
character in <numeric expression 1> of <character string expression> is less than
<numeric expression 2>, all the character strings starting with the character in <numeric
expression 1> of <character string expression> will be returned.