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

Add Uiua
(Add ABC)
(Add Uiua)
(4 intermediate revisions by 4 users not shown)
Line 1,465:
 
=={{header|F_Sharp|F#}}==
<syntaxhighlight lang="fsharp">let stripChars text (chars:string) =
let stripChars text (chars:string) =
ArraySeq.fold (
fun (s:string) c -> s.Replace(c.ToString(),"")
) text (chars.ToCharArray())
printfn "%s" (stripChars "She was a soul stripper. She took my heart!" "aei")
 
0</syntaxhighlight>
[<EntryPoint>]
{{out}}
let main args =
<pre>
printfn "%s" (stripChars "She was a soul stripper. She took my heart!" "aei")
<pre>Sh ws soul strppr. Sh took my hrt!</pre>
0</syntaxhighlight>
</pre>
Output
<pre>Sh ws soul strppr. Sh took my hrt!</pre>
 
=={{header|Factor}}==
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,791 ⟶ 2,804:
<pre>- stripchars ("She was a soul stripper. She took my heart!", "aei") ;
val it = "Sh ws soul strppr. Sh took my hrt!" : string</pre>
 
=={{header|Stringle}}==
<syntaxhighlight lang="stringle">a "She was a soul stripper. She took my heart!"
b "aei"
#a
c c .a
b %.\c #c #:c
a :a
#a
$ c
</syntaxhighlight>
{{out}}
<pre>Sh ws soul strppr. Sh took my hrt!</pre>
 
=={{header|Swift}}==
Line 2,905 ⟶ 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