How to resolve the algorithm Strip a set of characters from a string step by step in the CLU 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 CLU 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 CLU programming language
Source code in the clu programming language
stripchars = proc (input, chars: string) returns (string)
result: array[char] := array[char]$[]
for c: char in string$chars(input) do
if string$indexc(c, chars) = 0 then
array[char]$addh(result, c)
end
end
return(string$ac2s(result))
end stripchars
start_up = proc ()
po: stream := stream$primary_output()
stream$putl(po,
stripchars("She was a soul stripper. She took my heart!", "aei"))
end start_up
You may also check:How to resolve the algorithm Monty Hall problem step by step in the C# programming language
You may also check:How to resolve the algorithm Arrays step by step in the LFE programming language
You may also check:How to resolve the algorithm Convert seconds to compound duration step by step in the COBOL programming language
You may also check:How to resolve the algorithm AKS test for primes step by step in the jq programming language
You may also check:How to resolve the algorithm Sorting algorithms/Bogosort step by step in the BBC BASIC programming language