@rvs1977 said:
I wonder why the eval-rescue solution has to be avoided? Is it slow?
ALL String operations in Ruby 1.8.x are slow.
eval() is the Ruby code parser.. so it is a very large method (actually a C-side function.)
But I cannot see it being slower than the 2 iterator methods you are using, in addition to the type converter.
But it works... and you understand how it works. If speed is not an issue, then go with it ...
Also if you KNEW each numeric was separated by a "," then you also do:
@YV_array = yv_array.split(',').map{|i| i.to_i}