MID$ function

Purpose: MID$ returns a substring of a string.


 Syntax:

 SubStr$ = MID$(MainStr$, Start% [, Length%])

 Parameters:

  • SubStr$ Returned substring extracted from MainStr$.
  • MainStr$ String from which SubStr$ is extracted.
  • Start% Integer specifying the start position of the SubStr$ to be extracted from MainStr$.
  • Length% [OPTIONAL] Length of the substring to be extracted. This can be omitted if all the characters to the right of Start% are to be retrieved.

Remarks: It is the responsibility of the programmer to ensure that the receiving string is large enough to hold the string being returned from MID$.

Example 1 :


 SubStr$ = MID$("abcdefg", 3, 4)

Result: SubStr$ will equal "cdef".

Example 2:


 SubStr$ = MID$("abcdefg", 2)

Result:

SubStr$ will equal "bcdefg".

BCX Console Sample Programs using MID$ function.

S17.bas   S23.bas   S39.bas   S55.bas   S61.bas   S84.bas   S87.bas   S110.bas