るりまサーチ (Ruby 2.7.0)

最速Rubyリファレンスマニュアル検索!
1件ヒット [1-1件を表示] (0.135秒)
トップページ > 種類:インスタンスメソッド[x] > バージョン:2.7.0[x] > クエリ:i[x] > クエリ:|[x] > クエリ:chop![x] > クラス:String[x]

別のキーワード

  1. _builtin |
  2. ipaddr |
  3. set |
  4. integer |
  5. array |

ライブラリ

検索結果

String#chop! -> self | nil (63985.0)

文字列の最後の文字を取り除きます。 ただし、終端が "\r\n" であればその 2 文字を取り除きます。

...った場合は nil を返します。

//emlist[例][ruby]{
str = "string\r\n"
ret = str.chop!
ret # => "string"
str # => "string"
str.chop! # => "strin"
"".chop! # => nil
//}

@see String#chomp!
@see String#chop
@see String#delete_suffix!...