Strip a set of characters from a string: Difference between revisions
Strip a set of characters from a string (view source)
Revision as of 16:57, 17 June 2024
, 13 days agoAdd Uiua
No edit summary |
(Add Uiua) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1,875:
=={{header|Kotlin}}==
<syntaxhighlight lang="kotlin">
fun main(args: Array<String>) {
Line 2,115 ⟶ 2,113:
=={{header|Pascal}}==
See [[Strip_a_set_of_characters_from_a_string#Delphi|Delphi]]
=={{header|PascalABC.NET}}==
<syntaxhighlight lang="delphi">
function StripChars(s,chars: string): string
:= s.Where(c -> c not in chars).JoinToString;
begin
Print(StripChars('She was a soul stripper. She took my heart!','aei'));
end.
</syntaxhighlight>
{{out}}
<pre>
Sh ws soul strppr. Sh took my hrt!
</pre>
=={{header|Perl}}==
Line 2,918 ⟶ 2,931:
<code>(do if (memq @1 set) (list @1))</code> is just <code>(lambda (item) (if (memq item set) (list item)))</code>.
<code>mappend</code> happily maps over strings and since the leftmost input sequence is a string, and the return values of the lambda are sequence of characters, <code>mappend</code> produces a string.
=={{header|Uiua}}==
{{works with|Uiua|0.11.1}}
<syntaxhighlight lang="uiua">
Strip ← ▽¬∊,
Strip "aei" "She was a soul stripper. She took my heart!"
</syntaxhighlight>
{{out}}
<pre>
"Sh ws soul strppr. Sh took my hrt!"
</pre>
=={{header|UNIX Shell}}==
|