How to resolve the algorithm Strip a set of characters from a string step by step in the PureBasic 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 PureBasic 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 PureBasic programming language
Source code in the purebasic programming language
Procedure.s stripChars(source.s, charsToStrip.s)
Protected i, *ptrChar.Character, length = Len(source), result.s
*ptrChar = @source
For i = 1 To length
If Not FindString(charsToStrip, Chr(*ptrChar\c))
result + Chr(*ptrChar\c)
EndIf
*ptrChar + SizeOf(Character)
Next
ProcedureReturn result
EndProcedure
If OpenConsole()
PrintN(stripChars("She was a soul stripper. She took my heart!", "aei"))
Print(#CRLF$ + #CRLF$ + "Press ENTER to exit"): Input()
CloseConsole()
EndIf
You may also check:How to resolve the algorithm Gray code step by step in the Go programming language
You may also check:How to resolve the algorithm Empty program step by step in the Zoea programming language
You may also check:How to resolve the algorithm Caesar cipher step by step in the sed programming language
You may also check:How to resolve the algorithm N-queens problem step by step in the Befunge programming language
You may also check:How to resolve the algorithm Execute HQ9+ step by step in the Golo programming language