るりまサーチ

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

別のキーワード

  1. set difference
  2. array difference
  3. _builtin difference
  4. difference array

クラス

検索結果

Array#difference(*other_arrays) -> Array (18121.0)

自身から other_arrays の要素を取り除いた配列を生成して返します。

...素の順と同じです。

//emlist[例][ruby]{
[ 1, 1, 2, 2, 3, 3, 4, 5 ].difference([ 1, 2, 4 ]) # => [ 3, 3, 5 ]
[ 1, 'c', :s, 'yep' ].difference([ 1 ], [ 'a', 'c' ]) # => [:s, "yep"]
//}

集合のような振る舞いが必要なら Set も参照してください。

@see Array#-...