From: "Iñaki Baz Castillo" Date: 2009-12-11T07:51:58+09:00 Subject: Any Array method to delete elements and return them? Hi, I've an array like this: a = [1,2,3,"aaa","bbb",4,"ccc"] I want to remove from the array all the Strings, but also want these Strings in a new Array. Array#delete_if of Array#reject! is not valid because they delete elements but don't return them, but the modified array: a.reject! {|e| e.is_a?(String)} => [1, 2, 3, 4] a.delete_if {|e| e.is_a?(String)} => [1, 2, 3, 4] I want a method that deletes elements from the array and return the deleted elements, somethis as: a.delete_and_extract_if {|e| e.is_a?(String)} => ["aaa", "bbb", "ccc"] Does such method exist? PS: Of course I can do it by using Array#collet and Array#reject! in two different commands, but would like it to be more efficient. Thanks. -- Iñaki Baz Castillo