RosettaCodeData/Task/Strip-comments-from-a-string/Icon/strip-comments-from-a-string.icon
Ingy döt Net 68f8f3e56b all tasks
2013-04-11 01:07:29 -07:00

12 lines
452 B
Text

# strip_comments:
# return part of string up to first character in 'markers',
# or else the whole string if no comment marker is present
procedure strip_comments (str, markers)
return str ? tab(upto(markers) | 0)
end
procedure main ()
write (strip_comments ("apples, pears and bananas", cset ("#;")))
write (strip_comments ("apples, pears # and bananas", cset ("#;")))
write (strip_comments ("apples, pears ; and bananas", cset ("#;")))
end