RosettaCodeData/Task/Strip-comments-from-a-string/Sidef/strip-comments-from-a-string.sidef

10 lines
186 B
Text
Raw Permalink Normal View History

2016-12-05 23:44:36 +01:00
func strip_comment(s) {
(s - %r'[#;].*').strip;
}
[" apples, pears # and bananas",
" apples, pears ; and bananas",
" apples, pears "].each { |s|
say strip_comment(s).dump;
};