11-18-2022, 12:36 AM
(11-18-2022, 12:27 AM)bplus Wrote:Code: (Select All)a$ = "12345"
swapLetters a$, 3, 5
Print a$
swapLetters a$, 1, 4
Print a$
Sub swapLetters (a$, n, m)
t$ = Mid$(a$, n, 1)
Mid$(a$, n, 1) = Mid$(a$, m, 1)
Mid$(a$, m, 1) = t$
End Sub
You might want to swap to ASC over MID$, due to the speed and performance difference between the two commands. Letter swapping is usually something which ends up getting called inside loops, and it could really make a difference in how quickly the overall program performs here.