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

Add Uiua
No edit summary
(Add Uiua)
(2 intermediate revisions by 2 users not shown)
Line 1,875:
 
=={{header|Kotlin}}==
<syntaxhighlight lang="kotlin">//fun versionstripChars(s: 1String, r: String) = s.0.6filter { it !in r }
 
fun stripChars(s: String, r: String) = s.replace(Regex("[$r]"), "")
 
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}}==
1,827

edits