Ruby 2.5.0 リファレンスマニュアル > ライブラリ一覧 > 組み込みライブラリ > Stringクラス > delete_suffix
delete_suffix(suffix) -> String
[permalink][rdoc]文字列の末尾から suffix を削除した文字列のコピーを返します。
"hello".delete_suffix("llo") # => "he"
"hello".delete_suffix("hel") # => "hello"
[SEE_ALSO] String#chomp
[SEE_ALSO] String#chop
[SEE_ALSO] String#delete_prefix
[SEE_ALSO] String#delete_suffix!
[SEE_ALSO] String#end_with?