Strip a set of characters from a string: Difference between revisions
Content added Content deleted
(→{{header|Kotlin}}: Corrected Kotlin solution: the use of regex is error-prone, e.g. `stripChars("fails to remove ] bracket", "aei]")`) |
(PascalABC.NET) |
||
Line 2,113: | Line 2,113: | ||
=={{header|Pascal}}== |
=={{header|Pascal}}== |
||
See [[Strip_a_set_of_characters_from_a_string#Delphi|Delphi]] |
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}}== |
=={{header|Perl}}== |