From: Arlen Cuss Date: 2008-02-20T16:11:08+09:00 Subject: Re: split string ------=_Part_22515_2884320.1203491471465 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, On Feb 20, 2008 6:00 PM, Dan 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 ------=_Part_22515_2884320.1203491471465--