Older Version
Newer Version
bshipps64
Feb 19, 2006
- "First created"
StringChop$ function
A small function to remove any occurrences of one string from another.input "Original string: "; orig$
if (orig$ = "") then end
[loop]
input "Character(s) to chop: "; chop$
if (chop$ = "") then end
orig$ = StringChop$(orig$, chop$)
if (orig$ = "") then end
print "Chopped string: "; orig$
goto [loop]
function StringChop$(o$,c$)
cLen = len(c$)
do
cPos = instr(o$,c$,cPos)
if not(cPos) then exit do
pre$ = left$(o$,cPos - 1)
post$ = mid$(o$, cPos + cLen)
o$ = pre$ + post$
loop while 1
StringChop$ = o$
end function