C
Chris Lowis
Is there a short-cut to parsing a CSV file column-wise using any of
the available Ruby CSV libraries ?
For example, at the moment I have:
require 'csv'
data = "1,2,3\n4,5,6\n7,8,9"
CSV:arse(data) # => [["1", "2", "3"], ["4", "5", "6"], ["7", "8",
"9"]]
But what I'd like is:
CSV:arse(data,'columnwise') # => [["1", "4", "7"], ["2", "5",
"8"], ["3", "6", "9"]]
Perhaps I just need to run the returned array through some kind of
transformation ?
Chris
the available Ruby CSV libraries ?
For example, at the moment I have:
require 'csv'
data = "1,2,3\n4,5,6\n7,8,9"
CSV:arse(data) # => [["1", "2", "3"], ["4", "5", "6"], ["7", "8",
"9"]]
But what I'd like is:
CSV:arse(data,'columnwise') # => [["1", "4", "7"], ["2", "5",
"8"], ["3", "6", "9"]]
Perhaps I just need to run the returned array through some kind of
transformation ?
Chris