MID$

Format

string1 = MID$(string2,number1,number2)

Description

This statement is used to extract a substring from string2 beginning at position number1 within string2 and continuing for number2 bytes. This value is then stored in string1.

Example

A$="THE QUICK BROWN FOX"
B$=MID$(A$,1,4)
C$=MID$(A$,11,9)
D$=B$ + C$
After execution of these statements, the contents of A$ will be unchanged. The contents of B$ will be "THE ". The contents of C$ will be "BROWN FOX", and the contents of D$ will be "THE BROWN FOX".

See Also

  • LEFT$
  • RIGHT$