RosettaCodeData/Task/Strip-comments-from-a-string/Oforth/strip-comments-from-a-string.fth
2023-07-01 13:44:08 -04:00

4 lines
165 B
Forth

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