G
Guest
Hi all,
I read several rows of numbers and split each row into an array. I get
an array of array. By default Ruby treat each number as a string. I want
to convert each string into a number. The only way I can think of is to
loop through the old array of array, change each element in each row
using #to_f and put them back into a new array. It is not efficient.
What other options might be better?
Thanks,
Li
# file format
1 100 33 32
2 500 33 20
....
I read several rows of numbers and split each row into an array. I get
an array of array. By default Ruby treat each number as a string. I want
to convert each string into a number. The only way I can think of is to
loop through the old array of array, change each element in each row
using #to_f and put them back into a new array. It is not efficient.
What other options might be better?
Thanks,
Li
# file format
1 100 33 32
2 500 33 20
....