Strip comments from a string: Difference between revisions
Content added Content deleted
(→{{header|PureBasic}}: Add Python solution.) |
|||
Line 103: | Line 103: | ||
strip 'apples, pears ; and bananas' |
strip 'apples, pears ; and bananas' |
||
apples, pears </lang> |
apples, pears </lang> |
||
=={{header|Lua}}== |
|||
<lang lua>comment_symbols = ";#" |
|||
s1 = "apples, pears # and bananas" |
|||
s2 = "apples, pears ; and bananas" |
|||
print ( string.match( s1, "[^"..comment_symbols.."]+" ) ) |
|||
print ( string.match( s2, "[^"..comment_symbols.."]+" ) )</lang> |
|||
=={{header|PureBasic}}== |
=={{header|PureBasic}}== |