RosettaCodeData/Task/Strip-comments-from-a-string/Oforth/strip-comments-from-a-string.oforth
2016-12-05 23:44:36 +01:00

4 lines
165 B
Text

: stripComments(s, markers)
| firstMarker |
markers map(#[ s indexOf ]) reduce(#min) ->firstMarker
s firstMarker ifNotNull: [ left(firstMarker 1 - ) ] strip ;