Project

General

Profile

Actions

Feature #13665

closed

String#delete_suffix

Added by sonots (Naotoshi Seo) almost 7 years ago. Updated almost 7 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:81714]

Description

In https://bugs.ruby-lang.org/issues/12694, we decided to have String#delete_prefix.
It would be nice to have String#delete_suffix method to delete suffix from a string for symmetry although it can be achieved with String#chomp as:

class String
  def delete_suffix(substr)
    chomp(substr)
  end
  def delete_suffix!(substr)
    chomp!(substr)
  end
end

Any opinions?

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0