Problem with conversion array of strings to array of arrays of integers

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

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) }

W dniu 2011-04-06 01:44, Kendall Gifford pisze:

.map { |x| x.split(",").map(&:to_i) }

Thank you very much Kendall, it is exactly what i need.