MID(string, start[, length])
MIDB(string, start[, length])
Description
MID returns a string containing characters from the middle of a string. The required parameter, string, is any valid string expression. The required parameter, start, is any valid numeric expression, if start is greater than the length of string, a zero-length string is returned (""). The optional parameter, length, is any valid numeric expression and it specifies the number of characters to return. If length is not used, or exceeds the number of remaining characters in string, all characters from start to the end of string are returned.
MIDB is a strict bytewise version of MID. When used on the Unicode strings of Windows CE devices, it will return any partial character as a normal character.
Example
REM MID Example
'MID returns substring from string middle
DIM Eric, Mister
Eric = "Cartman"
PRINT "From Cartman:", MID(Eric, 2, 3)
Mister = "Hankey"
PRINT "From Hankey:", MID(Mister, 4)
Output
From Cartman: art
From Hankey: key
Related Items
LEFT, RIGHT