Strip a set of characters from a string: Difference between revisions

Content added Content deleted
Line 146: Line 146:
<pre>: (strDiff "She was a soul stripper. She took my heart!" "aei")
<pre>: (strDiff "She was a soul stripper. She took my heart!" "aei")
-> "Sh ws soul strppr. Sh took my hrt!"</pre>
-> "Sh ws soul strppr. Sh took my hrt!"</pre>

=={{header|PL/I}}==
<lang PL/I>
strip_chars: procedure (text, chars) returns (character (100) varying);
declare text character (*) varying, chars character (*) varying;
declare out_text character (100);
declare ch character (1);
declare (i, j) fixed binary;

j = 0;
do i = 1 to length(text);
ch = substr(text, i, 1);
if index(chars, ch) = 0 then
do; j = j + 1; substr(out_text, j, 1) = ch; end;
end;
return (substr(out_text, 1, j) );
end strip_chars;
</lang>


=={{header|PureBasic}}==
=={{header|PureBasic}}==