K
Kevin Olbrich
The problem:
read in a string containing an arbitrary number of comma separated
numbers and convert it to an array of numbers.
It seems like this could be a one-liner, but the best I can get is two...
w=input_string.split(/,\s*/)
w.each_index {|n| w[n]=w[n].to_f}
Anyone know a one-liner for this?
_Kevin
read in a string containing an arbitrary number of comma separated
numbers and convert it to an array of numbers.
It seems like this could be a one-liner, but the best I can get is two...
w=input_string.split(/,\s*/)
w.each_index {|n| w[n]=w[n].to_f}
Anyone know a one-liner for this?
_Kevin