RCR 136: String#chomp(/regexp/)
Submitted by anonymous (Sat May 03 11:05:17 UTC 2003)
Abstract
This is a legacy RCR from Ruby Garden, submitted by anonymous. Matz has declared these RCRs obsolete, and asked that their authors resubmit them in the new format.
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.)
Problem
(RCR imported from old format)
Proposal
Analysis
(RCR imported from old format)
Implementation
(RCR imported from old format)
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.
|
Strongly opposed |
0 |
Opposed |
0 |
Neutral |
0 |
In favor |
0 |
Strongly advocate |
0 |
|
RCRchive copyright © David Alan Black, 2003-2005.
Powered by .
Check out ri 1.8 (root, 2003-05-03 07:38:17)