How to resolve the algorithm Strip a set of characters from a string step by step in the BBC BASIC programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Strip a set of characters from a string step by step in the BBC BASIC programming language

Table of Contents

Problem Statement

Create a function that strips a set of characters from a string.

The function should take two arguments:

The returned string should contain the first string, stripped of any characters in the second argument:

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Strip a set of characters from a string step by step in the BBC BASIC programming language

Source code in the bbc programming language

      PRINT FNstripchars("She was a soul stripper. She took my heart!", "aei")
      END
      
      DEF FNstripchars(A$, S$)
      LOCAL I%, C%, C$
      FOR I% = 1 TO LEN(S$)
        C$ = MID$(S$, I%, 1)
        REPEAT
          C% = INSTR(A$, C$)
          IF C% A$ = LEFT$(A$, C%-1) + MID$(A$, C%+1)
        UNTIL C% = 0
      NEXT
      = A$


  

You may also check:How to resolve the algorithm Loops/For step by step in the Red programming language
You may also check:How to resolve the algorithm Memory allocation step by step in the AutoHotkey programming language
You may also check:How to resolve the algorithm JortSort step by step in the FreeBASIC programming language
You may also check:How to resolve the algorithm Copy a string step by step in the Nim programming language
You may also check:How to resolve the algorithm Jacobsthal numbers step by step in the Haskell programming language