Jump to content

Strip block comments: Difference between revisions

m
added whitespace before the TOC (table of contents), added a ;Task: (bold) header, added bullet points.
m (added whitespace before the TOC (table of contents), added a ;Task: (bold) header, added bullet points.)
Line 1:
{{task|Text processing}}[[Category:String manipulation]]
[[Category:String manipulation]]
A block comment begins with a ''beginning delimiter'' and ends with a ''ending delimiter'', including the delimiters. These delimiters are often multi-character sequences.
 
A block comment begins with a   ''beginning delimiter''   and ends with a   ''ending delimiter'',   including the delimiters.   These delimiters are often multi-character sequences.
 
 
;Task:
Strip block comments from program text (of a programming language much like classic [[C]]).
 
Your demos should at least handle simple, non-nested and multi-line block comment delimiters.
 
The block comment delimiters are the two-character sequence:
:::* &nbsp; &nbsp; <big><big> '''/*''' </big></big> &nbsp; &nbsp; (beginning delimiter)
:::* &nbsp; &nbsp; <big><big> '''*/''' </big></big> &nbsp; &nbsp; (ending delimiter)
 
'''Task:''' Strip block comments from program text (of a programming language much like classic [[C]]). Your demos should at least handle simple, non-nested and multiline block comment delimiters. The beginning delimiter is the two-character sequence “<tt>/*</tt>” and the ending delimiter is “<tt>*/</tt>”.
 
Sample text for stripping:
Line 24 ⟶ 35:
</pre>
 
;Extra credit:
'''Extra credit:''' Ensure that the stripping code is not hard-coded to the particular delimiters described above, but instead allows the caller to specify them. &nbsp; (If your language supports them, &nbsp; [[Optional parameters|optional parameters]] &nbsp; may be useful for this.)
 
 
;Related task:
C.f:* &nbsp; [[Strip comments from a string]]
<br><br>
 
=={{header|Ada}}==
Cookies help us deliver our services. By using our services, you agree to our use of cookies.