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

9 lines
186 B
Text

func strip_comment(s) {
(s - %r'[#;].*').strip;
}
[" apples, pears # and bananas",
" apples, pears ; and bananas",
" apples, pears "].each { |s|
say strip_comment(s).dump;
};