(11-18-2022, 02:49 PM)mnrvovrfc Wrote:(11-18-2022, 12:36 AM)SMcNeill Wrote: You might want to swap to ASC over MID$, due to the speed and performance difference between the two commands."ASC" might make a good keyword of the day, "my gosh how it's grown" or "not if you went to Dartmouth" or something like that.
Yes, it is very interesting that it can be used like the MID$ Statement!!!
Referring to this:
Code: (Select All)
a$ = "ABCDEFG"
Print SwapString(a$, 3, 5)
Function SwapString$ (s_passed$, pos1, pos2)
s$ = s_passed$ 'so we don't change by parameter
temp = Asc(s$, pos1)
Asc(s$, pos1) = Asc(s$, pos2)
Asc(s$, pos2) = temp
SwapString$ = s$
End Function
You can alter the ASC's and not bother with CHR$() to convert back to string.
Also I agree with PhilOfPerth that using his 2 variable change is nice simple straight forward solution too.
b = b + ...