RosettaCodeData/Task/Strip-comments-from-a-string/Ring/strip-comments-from-a-string.ring

14 lines
359 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
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