From: Robert Klemme Date: 2008-05-13T21:08:38+09:00 Subject: Re: Convert integer to array? 2008/5/12 Robert Klemme : > On 12.05.2008 10:36, Nadim Kobeissi wrote: > > > Let's say I have: > > x=1234 > > How can I convert that to the follow array: > > x=[1, 2, 3, 4] > > > > Any help would be greatly appreciated. > > > > x.scan /\d/ Ah, not really. What I meant was: x.to_s.scan(/\d/).map {|i| i.to_i} Cheers robert -- use.inject do |as, often| as.you_can - without end