Skip to main content
guest
Join | Help | Sign In
Liberty BASIC Community Wiki Home
guest| Join | Help | Sign In
Liberty BASIC Community Wiki
  • Wiki Home
  • Recent Changes
  • Pages and Files
  • Members
  • Home
    • Liberty BASIC FAQ
    • Contests
    • Tutorials
    • Science
    • Shared Code
    • Tips
    • DLLs
    • PublicDomainSprites
    • Member Pages
    • Links
    • Sandbox

RemoveFromString3

Edit 0 3 …
  • 0 Tags
    • No tags
  • Notify
  • RSS
  • Backlinks
  • Source
  • Print
  • Export (PDF)
Older Version Newer Version

bshipps64 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!
 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
Help · About · Pricing · Privacy · Terms · Support · Upgrade
Contributions to https://basic.wikispaces.com/ are licensed under a Creative Commons Attribution Share-Alike 2.5 License. Creative Commons Attribution Share-Alike 2.5 License
Portions not contributed by visitors are Copyright 2018 Tangient LLC
TES: The largest network of teachers in the world
Turn off "Getting Started"
  1. Home
  2. ...
Loading...