Re: How to remove empty element in an array

From: Li Chen

I have an array of [1,2,’’] I want change it to [1,2].

irb(main):001:0> a = [1,2,’’]
=> [1, 2, “”]
irb(main):002:0> a.delete( ‘’ )
=> “”
irb(main):003:0> a
=> [1, 2]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs