Is it possible to convert array like this ["0", "1", "2", "1,2", "3", "1,3", "1,2,3,4,5,6,9"]
to this [[0], [1], [2], [1,2], [3], [1,3], [1,2,3,4,5,6,9]] (all should be int)
Any help will be very appreciated couse I've really stucked with this.
Hi
Is it possible to convert array like this [“0”, “1”, “2”, “1,2”,
“3”, “1,3”, “1,2,3,4,5,6,9”]
to this [[0], [1], [2], [1,2], [3], [1,3], [1,2,3,4,5,6,9]] (all should
be int)
Any help will be very appreciated couse I’ve really stucked with this.
Thanks in advance,
Bartek Iwaszkiewicz
x = [“0”, “1”, “2”, “1,2”, “3”, “1,3”, “1,2,3,4,5,6,9”]
y = x.map { |z| z.split(“,”).map(&:to_i) }