How to resolve the algorithm Strip a set of characters from a string step by step in the Liberty 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 Liberty 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 Liberty BASIC programming language

Source code in the liberty programming language

Print stripchars$("She was a soul stripper. She took my heart!", "aei", 1)
End

Function stripchars$(strip$, chars$, num)
    For i = 1 To Len(strip$)
        If Mid$(strip$, i, 1) <> Mid$(chars$, num, 1) Then
            stripchars$ = (stripchars$ + Mid$(strip$, i, 1))
        End If
    Next i
    If (num <= Len(chars$)) Then stripchars$ = stripchars$(stripchars$, chars$, (num + 1))
End Function

  

You may also check:How to resolve the algorithm Convert decimal number to rational step by step in the Wren programming language
You may also check:How to resolve the algorithm Arithmetic numbers step by step in the FreeBASIC programming language
You may also check:How to resolve the algorithm Loops/Foreach step by step in the LDPL programming language
You may also check:How to resolve the algorithm Knuth's algorithm S step by step in the REXX programming language
You may also check:How to resolve the algorithm Faulhaber's formula step by step in the C++ programming language