Strip a set of characters from a string: Difference between revisions
Strip a set of characters from a string (view source)
Revision as of 21:11, 13 June 2022
, 1 year agoAdd Draco
Not a robot (talk | contribs) (Add CLU) |
Not a robot (talk | contribs) (Add Draco) |
||
Line 1,121:
Writeln(StripChars(TEST_STRING, 'aei'));
end.</lang>
=={{header|Draco}}==
<lang draco>\util.g
proc nonrec stripchars(*char str, chars, outbuf) *char:
channel input text ch_in;
channel output text ch_out;
[2]char cur = ('\e', '\e');
open(ch_in, str);
open(ch_out, outbuf);
while read(ch_in; cur[0]) do
if CharsIndex(chars, &cur[0]) = -1 then
write(ch_out; cur[0])
fi
od;
close(ch_in);
close(ch_out);
outbuf
corp
proc nonrec main() void:
[128]char buf;
writeln(
stripchars("She was a soul stripper. She took my heart!",
"aei", &buf[0]))
corp</lang>
{{out}}
<pre>Sh ws soul strppr. Sh took my hrt!</pre>
=={{header|EchoLisp}}==
|