Mikel Lindsaar wrote:
> On Mon, May 12, 2008 at 6:36 PM, Nadim Kobeissi <kaepora / mac.com> wrote:
>> Let's say I have:
>>  x=1234
>>  How can I convert that to the follow array:
>>  x=[1, 2, 3, 4]

Most of the other ways are better, but none-the-less:

x=1234
array = []

results = x.to_s.split('')
results.each{|x| array << x.to_i}

array #=> [1,2,3,4]

Regards,

- Mac
-- 
Posted via http://www.ruby-forum.com/.