Strip comments from a string: Difference between revisions

Content added Content deleted
m (→‎{{header|Wren}}: Changed to Wren S/H)
(PascalABC.NET)
 
Line 1,511: Line 1,511:
=={{header|Pascal}}==
=={{header|Pascal}}==
See [[Strip_comments_from_a_string#Delphi | Delphi]]
See [[Strip_comments_from_a_string#Delphi | Delphi]]

=={{header|PascalABC.NET}}==
<syntaxhighlight lang="delphi">
function RemoveComments(s,delim: string): string
:= Regex.Replace(s, delim + '.+', '');

begin
Writeln(RemoveComments('apples, pears # and bananas','#'));
Writeln(RemoveComments('apples, pears ; and bananas',';'));
end.
</syntaxhighlight>
{{out}}
<pre>
apples, pears
apples, pears
</pre>


=={{header|Perl}}==
=={{header|Perl}}==