るりまサーチ

最速Rubyリファレンスマニュアル検索!
6件ヒット [1-6件を表示] (0.046秒)
トップページ > ライブラリ:ビルトイン[x] > クエリ:set[x] > クエリ:difference[x]

別のキーワード

  1. set new
  2. stringio set_encoding
  3. _builtin set_encoding
  4. tracer set_get_line_procs
  5. set divide

クラス

検索結果

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#-...