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