Strip a set of characters from a string: Difference between revisions
Content deleted Content added
Not a robot (talk | contribs) Add PL/M |
Not a robot (talk | contribs) Add BCPL |
||
Line 773:
Sh ws soul strppr. Sh took my hrt!
</pre>
=={{header|BCPL}}==
<lang bcpl>get "libhdr"
let contains(str, chr) = valof
$( for i = 1 to str%0
if str%i = chr resultis true
resultis false
$)
let stripchars(str, chars, buf) = valof
$( buf%0 := 0
for i = 1 to str%0
if ~contains(chars, str%i)
$( buf%0 := buf%0 + 1
buf%(buf%0) := str%i
$)
resultis buf
$)
let start() be
$( let buf = vec 127
writef("%S*N",
stripchars("She was a soul stripper. She took my heart!",
"aei",
buf))
$)</lang>
{{out}}
<pre>Sh ws soul strppr. Sh took my hrt!</pre>
=={{header|BQN}}==
|