11-18-2022, 12:23 AM
You're not swapping any sort of variables...
a$ = "ABCDEFG"
swap mid$(a$,3,1),mid$(a$,5,1)
Evaluate those mid$ functions down:
SWAP "C", "E"
You're not swapping any variable values like that!
I think what you're looking for is something more like:
a$ = "ABCDEFG"
swap mid$(a$,3,1),mid$(a$,5,1)
Evaluate those mid$ functions down:
SWAP "C", "E"
You're not swapping any variable values like that!
I think what you're looking for is something more like:
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