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

Source code in the algol programming language

#!/usr/local/bin/a68g --script #

PROC strip chars = (STRING mine, ore)STRING: (
  STRING out := "";
  FOR i FROM LWB mine TO UPB mine DO
    IF NOT char in string(mine[i], LOC INT, ore) THEN
      out +:= mine[i]
    FI
  OD;
  out[@LWB mine]
);

printf(($gl$,stripchars("She was a soul stripper. She took my heart!","aei")))

  

You may also check:How to resolve the algorithm Literals/Integer step by step in the GAP programming language
You may also check:How to resolve the algorithm Abundant, deficient and perfect number classifications step by step in the Python programming language
You may also check:How to resolve the algorithm Integer comparison step by step in the Computer/zero Assembly programming language
You may also check:How to resolve the algorithm Create a two-dimensional array at runtime step by step in the M2000 Interpreter programming language
You may also check:How to resolve the algorithm Multiplicative order step by step in the 11l programming language