From: Mike Dvorkin Date: 2006-10-18T10:12:42+09:00 Subject: Re: Seems so simple, but is this really the only way, or most direct way? id.unpack('c' * id.size).map { |x| x-48 } # without regex and to_i conversions Mike Dvorkin http://www.rubywizards.com On Oct 17, 2006, at 5:36 PM, John Pywtorak wrote: > 9 digits in a string "123456789", convert to individual Fixnums > [1,2,3,4,5,6,7,8,9], or as below > > a, b, c, d, e, f, g, h, i = id.scan(/\d/).map(&:to_i) > > Simpler yet how about ["1", "2", ...]. Is scan the only direct way? > > I tried the "*" mechanism, no such luck, and tried array slicing > again no luck. TIA > -- > John Pywtorak > Cal Poly State University > ITS/ASAS > 805-756-5906 > > >