ActionsLike0
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) over 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) about 10 years ago
Updated by usa (Usaku NAKAMURA) about 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) about 10 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
Updated by nagachika (Tomoyuki Chikanaga) about 10 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
ActionsLike0