ruby - Remove element from array by type -


i have following array:

["--",1,2,3,4] 

how can remove elements array element type, ie. remove non-integer values array?

i'd :-

ary = ["--",1,2,3,4] ary = ary.grep(integer)  ary # => [1, 2, 3, 4] 

note :- if don't want mutate original array use new_ary instead of ary. like

new_ary = ary.grep(integer)  

Comments

Popular posts from this blog

How to access named pipes using JavaScript in Firefox add-on? -

multithreading - OPAL (Open Phone Abstraction Library) Transport not terminated when reattaching thread? -

node.js - req param returns an empty array -