11-18-2022, 02:41 AM
Swapping letter positions inside a string, *without* the use of a single temp variable.
Code: (Select All)
a$ = "ABCDEFG"
SwapLetter a$, 3, 5
Print a$
Sub SwapLetter (a$, p1, p2)
a$ = a$ + Mid$(a$, p1, 1)
Mid$(a$, p1) = Mid$(a$, p2, 1)
Mid$(a$, p2) = Right$(a$, 1)
a$ = Left$(a$, Len(a$) - 1)
End Sub