MID$ statement
Purpose: Replaces a portion of a string with a substring.
Syntax: MID$(MainStr$, Start% [, SubStrLen%]) = SubStr$ Parameters:
|
Example:
DIM str1$, str2$ str1$ = "12345" str2$ = "abc" ' Copy the contents of str2$ to str1$ ' starting at the 2nd character MID$(str1$, 2) = str2$ PRINT str1$ str1$ = "12345" str2$ = "abc" ' Copy only the first 2 characters of str2$ to str1$ ' starting at the 2nd character. MID$(str1$, 2, 2) = str2$ PRINT str1$
Result:
1abc5 1ab45
BCX Console Sample Programs using MID$ statement.