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

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -