Examples: Mid statement

The three-character string "BCD", beginning at the second character of string1, is replaced with the first three characters contained in string2, "123".

Dim string1 As String, string2 As String
string1$ = "ABCDEF"
string2$ = "12345"
' Replace the characters "BCD" in string1
' with the characters "123" in string2. 
Mid$(string1$, 2, 3) = string2$
Print string1$        ' Output: A123EF

The three-character string "BCD", beginning at the second character of string1, is replaced with the first three characters contained in string2, "123".