I have the following array
cities = [\"Kathmandu\", \"Pokhara\", \"\", \"Dharan\", \"Butwal\"]
I want to remove blank elements from the ar
Here is a solution if you have mixed types in your array:
[nil,"some string here","",4,3,2]
Solution:
[nil,"some string here","",4,3,2].compact.reject{|r| r.empty? if r.class == String}
Output:
=> ["some string here", 4, 3, 2]