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

Source code in the vbscript programming language

Function stripchars(s1,s2)
	For i = 1 To Len(s1)
		If InStr(s2,Mid(s1,i,1)) Then
			s1 = Replace(s1,Mid(s1,i,1),"")
		End If
	Next
	stripchars = s1
End Function

WScript.StdOut.Write stripchars("She was a soul stripper. She took my heart!","aei")

  

You may also check:How to resolve the algorithm Factors of an integer step by step in the K programming language
You may also check:How to resolve the algorithm Simple database step by step in the Erlang programming language
You may also check:How to resolve the algorithm Flatten a list step by step in the Ring programming language
You may also check:How to resolve the algorithm Halt and catch fire step by step in the XBS programming language
You may also check:How to resolve the algorithm Casting out nines step by step in the BASIC programming language