MID$ ISSUE

BlitzPlus Forums/BlitzPlus Beginners Area/MID$ ISSUE

dna(Posted 2015) [#1]
Hello

Why does the instruction:

Mid$(H$,J-1,1)=Mid$(H$,J,1):


not work? Is that a bug in BB?


GfK(Posted 2015) [#2]
It isn't a bug - you just can't use Mid() to replace part of a string.


dna(Posted 2015) [#3]
Wow!!
That syntax works in some other versions of basic.

I'll have to rewrite it.


okee(Posted 2015) [#4]
H$ = Replace$(H$, Mid$(H$,j-1,1), Mid$(H$,j,1))


would do the job.


ziggy(Posted 2015) [#5]
If should be expressed like this:

H$ = Left(H$, J - 1) + Mid(H$, J + 1, 1) + Mid(H$, J + 1)



dna(Posted 2015) [#6]
I never knew there was a replace command.