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

Source code in the netrexx programming language

/* NetRexx */

options replace format comments java crossref savelog symbols

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

return

method stripchars(haystack, chs) public static

  loop c_ = 1 to chs.length
    needle = chs.substr(c_, 1)
    haystack = haystack.changestr(needle, '')
    end c_

  return haystack

  

You may also check:How to resolve the algorithm Rhonda numbers step by step in the Arturo programming language
You may also check:How to resolve the algorithm Hello world/Line printer step by step in the REXX programming language
You may also check:How to resolve the algorithm Ternary logic step by step in the PHP programming language
You may also check:How to resolve the algorithm Set step by step in the Nemerle programming language
You may also check:How to resolve the algorithm Cumulative standard deviation step by step in the D programming language