るりまサーチ

最速Rubyリファレンスマニュアル検索!
409件ヒット [1-100件を表示] (0.234秒)

別のキーワード

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

クラス

キーワード

検索結果

<< 1 2 3 ... > >>

Hash#delete(key) -> object | nil (26129.0)

key に対応する要素を取り除きます。

...ッチする要素がなかった時に評価され、その結果を返します。

//emlist[例][ruby]{
h = {:ab => "some" , :cd => "all"}

p h.delete(:ab) #=> "some"
p h.delete(:ef) #=> nil
p h.delete(:ef){|key|"#{key} Nothing"} #=> "ef Nothing"

p h #=> {:cd=>"all"}
//}

@see Hash#delete_if...

Hash#delete(key) {|key| ... } -> object (26129.0)

key に対応する要素を取り除きます。

...ッチする要素がなかった時に評価され、その結果を返します。

//emlist[例][ruby]{
h = {:ab => "some" , :cd => "all"}

p h.delete(:ab) #=> "some"
p h.delete(:ef) #=> nil
p h.delete(:ef){|key|"#{key} Nothing"} #=> "ef Nothing"

p h #=> {:cd=>"all"}
//}

@see Hash#delete_if...

Array#delete(val) -> object | nil (26123.0)

指定された val と == で等しい要素を自身からすべて取り除きます。 等しい要素が見つかった場合は最後に見つかった要素を、 そうでない場合には nil を返します。

...rray = [1, 2, 3, 2, 1]
p array.delete(2) #=> 2
p array #=> [1, 3, 1]

# ブロックなしの引数に nil を渡すとその戻り値から削除が
# 行われたかどうかの判定をすることはできない
ary = [nil,nil,nil]
p ary.delete(nil) #=> nil
p ary...

Array#delete(val) { ... } -> object (26123.0)

指定された val と == で等しい要素を自身からすべて取り除きます。 等しい要素が見つかった場合は最後に見つかった要素を、 そうでない場合には nil を返します。

...rray = [1, 2, 3, 2, 1]
p array.delete(2) #=> 2
p array #=> [1, 3, 1]

# ブロックなしの引数に nil を渡すとその戻り値から削除が
# 行われたかどうかの判定をすることはできない
ary = [nil,nil,nil]
p ary.delete(nil) #=> nil
p ary...

String#delete(*strs) -> String (26122.0)

self から strs に含まれる文字を取り除いた文字列を生成して返します。

...合は、
すべての引数にマッチする文字だけが削除されます。

@param strs 削除する文字列を示す文字列 (のリスト)

//emlist[例][ruby]{
p "123456789".delete("2378") #=> "14569"
p "123456789".delete("2-8", "^4-6") #=> "14569"
//}

@see String#delete!...

絞り込み条件を変える

String#delete!(*strs) -> self | nil (14128.0)

self から strs に含まれる文字を破壊的に取り除きます。

...r.delete!("2378") #=> "14569"
p str #=> "14569"

str = "123456789"
p str.delete!("2-8", "^4-6") #=> "14569"
p str #=> "14569"

str = "abc"
p str.delete!("2378") #=> "nil"
p str #=> "abc"
//}

@see String#delete...

String#delete_prefix!(prefix) -> self | nil (14128.0)

self の先頭から破壊的に prefix を削除します。

...ら削除する文字列を指定します。

@return 削除した場合は self、変化しなかった場合は nil

//emlist[][ruby]{
"hello".delete_prefix!("hel") # => "lo"
"hello".delete_prefix!("llo") # => nil
//}

@see String#delete_prefix
@see String#delete_suffix!
@see String#start_with?...

String#delete_prefix(prefix) -> String (14128.0)

文字列の先頭から prefix を削除した文字列のコピーを返します。

...する文字列を指定します。

@return 文字列の先頭から prefix を削除した文字列のコピー

//emlist[][ruby]{
"hello".delete_prefix("hel") # => "lo"
"hello".delete_prefix("llo") # => "hello"
//}

@see String#delete_prefix!
@see String#delete_suffix
@see String#start_with?...

String#delete_suffix!(suffix) -> self | nil (14128.0)

self の末尾から破壊的に suffix を削除します。

...ます。

@return 削除した場合は self、変化しなかった場合は nil

//emlist[][ruby]{
"hello".delete_suffix!("llo") # => "he"
"hello".delete_suffix!("hel") # => nil
//}

@see String#chomp!
@see String#chop!
@see String#delete_prefix!
@see String#delete_suffix
@see String#end_with?...

String#delete_suffix(suffix) -> String (14128.0)

文字列の末尾から suffix を削除した文字列のコピーを返します。

...

@return 文字列の末尾から suffix を削除した文字列のコピー

//emlist[][ruby]{
"hello".delete_suffix("llo") # => "he"
"hello".delete_suffix("hel") # => "hello"
//}

@see String#chomp
@see String#chop
@see String#delete_prefix
@see String#delete_suffix!
@see String#end_with?...

絞り込み条件を変える

Array#delete_if -> Enumerator (14127.0)

要素を順番にブロックに渡して評価し、その結果が真になった要素をすべて削除します。 delete_if は常に self を返しますが、reject! は要素が 1 つ以上削除されれば self を、 1 つも削除されなければ nil を返します。

...要素を順番にブロックに渡して評価し、その結果が真になった要素をすべて削除します。
delete
_if は常に self を返しますが、reject! は要素が 1 つ以上削除されれば self を、
1 つも削除されなければ nil を返します。

ブロック...
...ッドには、
もとの配列に対して副作用があることに注意してください。

//emlist[例][ruby]{
a = [0, 1, 2, 3, 4, 5]
a.delete_if{|x| x % 2 == 0}
p a #=> [1, 3, 5]

a = [0, 1, 2, 3, 4, 5]
e = a.reject!
e.each{|i| i % 2 == 0}
p a #=> [1, 3, 5] もとの配...
<< 1 2 3 ... > >>