Strip comments from a string: Difference between revisions
Content added Content deleted
(→{{header|D}}: added fortran) |
(→{{header|PureBasic}}: Add Python solution.) |
||
Line 128: | Line 128: | ||
PrintN(Strip_comments(#instring2))</pre><pre>apples, pears |
PrintN(Strip_comments(#instring2))</pre><pre>apples, pears |
||
apples, pears</pre> |
apples, pears</pre> |
||
=={{header|Python}}== |
|||
<lang python>>>> marker, line = '#', 'apples, pears # and bananas' |
|||
>>> line[:line.index(marker)] |
|||
'apples, pears ' |
|||
>>> |
|||
>>> marker, line = ';', 'apples, pears ; and bananas' |
|||
>>> line[:line.index(marker)] |
|||
'apples, pears '</lang> |
|||
=={{header|REXX}}== |
=={{header|REXX}}== |