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

13 lines
359 B
Text

aList = 'apples, pears # and bananas'
see aList + nl
see stripComment(aList) + nl
aList = 'apples, pears // and bananas'
see aList + nl
see stripComment(aList) + nl
func stripComment bList
nr = substr(bList,"#")
if nr > 0 cList = substr(bList,1,nr-1) ok
nr = substr(bList,"//")
if nr > 0 cList = substr(bList,1,nr-1) ok
return cList