るりまサーチ

最速Rubyリファレンスマニュアル検索!
11件ヒット [1-11件を表示] (0.050秒)
トップページ > クラス:String[x] > クエリ:_builtin[x] > クエリ:chop![x]

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

ライブラリ

検索結果

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

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

...@return chop! は self を変更して返しますが、取り除く文字がなかった場合は 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...
...# => nil
//}

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