Actions
Bug #10582
closedString#chomp strips off more newlines than its documentation states
Description
Given an empty string as its parameter, String#chomp strips off as many trailing newlines as are present, plus a preceding carriage return if one exists:
irb(main):001:0> "foo\n\n\n".chomp
=> "foo\n\n"
irb(main):002:0> "foo\n\n\n".chomp ''
=> "foo"
irb(main):003:0> "foo\r\n\n\n".chomp ''
=> "foo"
This should either be mentioned as part of String#chomp's documentation, or removed.
Files
Updated by nobu (Nobuyoshi Nakada) almost 10 years ago
- Assignee changed from matz (Yukihiro Matsumoto) to zzak (zzak _)
- Target version set to 2.2.0
- Category set to doc
- Status changed from Open to Assigned
Updated by hsbt (Hiroshi SHIBATA) almost 10 years ago
Updated by javawizard (Alex Boyd) almost 10 years ago
Looks good to me. Thanks!
Updated by hsbt (Hiroshi SHIBATA) almost 10 years ago
Updated by usa (Usaku NAKAMURA) almost 10 years ago
- Backport changed from 2.0.0: UNKNOWN, 2.1: REQUIRED, 2.2: DONTNEED to 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: DONTNEED
Updated by usa (Usaku NAKAMURA) over 9 years ago
- Backport changed from 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: DONTNEED to 2.0.0: DONE, 2.1: REQUIRED, 2.2: DONTNEED
ruby_2_0_0 r49733 merged revision(s) 48747.
Updated by nagachika (Tomoyuki Chikanaga) over 9 years ago
- Backport changed from 2.0.0: DONE, 2.1: REQUIRED, 2.2: DONTNEED to 2.0.0: DONE, 2.1: DONE, 2.2: DONTNEED
Backported into ruby_2_1
branch at r49911.
Actions
Like0
Like0Like0Like0Like0Like0Like0Like0