RCR 136: String#chomp(/regexp/)
submitted by anonymous on 2003-05-03 07:34:17
This is a legacy RCR. If this is your RCR, please resubmit it using the new format and process.
I think it would be a nice feature to be able to do something like str.chomp(/r?n/) to cut off both dos and unix style newlines. (This can already be done like str.subs(/r?n$/), but str.chomp(/re/) would look more like a chomp and be slightly simpler.)
Vote for this RCR
Add comments here
You can already use chomp to strip DOS or Unix line endings (that is, it'll remove CR/LF or just LF). It doesn't take regexps though.
Back to RCRchive.
RCR Submission page and RCRchive powered by Ruby, Apache, RuWiki (modified), and RubLog