Older Version
Newer Version
bshipps64
Feb 19, 2006
- "First created"
== StringChop$ function ==
A small function to remove any occurrences of one string from another.
----
> The brand new StringChop$ 9000!!! IT SLICES!! IT DICES!! (Does not Julienne at this time). This function simply locates the position of a 'find' string within a 'source' string, grabs everything before and after it, combines those two as a new 'source' string and repeats the process on that. Voila! Perfect potatoes every time! Delicious test program included! Enjoy!
[[code format="vbnet"]]
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
[[code]]