Arlen Cuss
2/20/2008 7:11:00 AM
[Note: parts of this message were removed to make it a legal post.]
Hi,
On Feb 20, 2008 6:00 PM, Dan <dan.macdaddy+ruby@gmail.com> wrote:
> I'm not sure if i really understand your question but if 3:43,2:65,3:50 is
> actually a string i.e. "3:43,2:65,3:50"
>
> then "3:43,2:65,3:50".gsub(':',' ').split(',') will return an array
> containing:
>
> ["3 43", "2 65", "3 50"]
>
If they're two columns of a database, then this will probably be more
helpful:
rows = @selected_ciid_and_asso_types.split(',').map {|e| e.split(':')}
=> [["3", "43"], ["2", "65"], ["3", "50"]]
You could also change the last bit to e.split(':').map {|s| s.to_i} if you
wanted [[3, 43], [2, 65], [3, 50]] instead.
Arlen