Strip comments from a string: Difference between revisions
Content added Content deleted
m (→{{header|Phix}}: syntax coloured) |
Drkameleon (talk | contribs) (Added Arturo implementation) |
||
Line 266: | Line 266: | ||
260 LET S$ = MID$(S$, 1, I) |
260 LET S$ = MID$(S$, 1, I) |
||
270 RETURN</lang> |
270 RETURN</lang> |
||
=={{header|Arturo}}== |
|||
<lang rebol>stripComments: function [str][ |
|||
strip replace str {/[#;].+/} "" |
|||
] |
|||
loop ["apples, pears # and bananas", "apples, pears ; and bananas"] 'str [ |
|||
print [str "->" stripComments str] |
|||
]</lang> |
|||
{{out}} |
|||
<pre>apples, pears # and bananas -> apples, pears |
|||
apples, pears ; and bananas -> apples, pears</pre> |
|||
=={{header|AutoHotkey}}== |
=={{header|AutoHotkey}}== |