Skip to content

Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →

instance method

String#delete_suffix!

(::string suffix) -> self?
delete_suffix!(suffix) → self or nil

Like String#delete_suffix, except that self is modified in place. Returns self if the suffix is removed, nil otherwise.