RosettaCodeData/Task/Strip-comments-from-a-string/Ring/strip-comments-from-a-string.ring
2023-07-01 13:44:08 -04: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