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