paul
9/25/2007 4:05:00 PM
On Tue, 2007-09-25 at 23:36 +0900, Analogy Analogy wrote:
> Hi Folks,
>
> I have a general newbie type question
> Say I have a 2D array that I obtained from an external program:
>
> array = [["a", "b", "", "c", "5"], ["d", "e", "f", "9.0", "7", "g", "",
> "", ""], ["", "h", "5", "", ""]]
this any good?
i'd assumed you just wanted to get rid of the two empty strings as
they're duplicates...
irb(main):015:0> arr = [['paul','fox','',''],['testing','123','','']]
=> [["paul", "fox", "", ""], ["testing", "123", "", ""]]
irb(main):016:0> arr.map{|a| pp a.uniq}
["paul", "fox", ""]
["testing", "123", ""]
=> [nil, nil]
irb(main):017:0>