MID$ returns a substring of given length starting at the given position. It may also be used as a statement.
B$=MID$ (A$,X, [Y])
MID$ (A$,X,[Y]) = C$
10 A$= "ABCDEFGH" 20 PRINT MID$ (A$,3,4)
A$, X or Y may be expressions. If Y is omitted then all characters to the right of the Xth character are returned.
In the above example:
MID$ (A$,0,3) = 'ABC'
MID$ (A$,20,5) = null string
MID$ (A$,7) = 'GH'
When MID$ is used as a statement in the form:
its sets the part of A$ starting at the Xth character with the substring C$. The optional parameter Y denotes the length of the part of A$ to be replaced and if omitted defaults to the length of C$.