From: Robert Schaaf Date: 2009-04-30T21:34:08+09:00 Subject: Re: (mandriva,eclipse) extract digits from fixnums You could try a.to_s.split(//).collect {|s| s.to_i} and extract nb_nb elements. Bob Schaaf On Apr 30, 2009, at 7:54 AM, lolveley wrote: > hi, > > I want to do a basic thing but without succes: > if a=1232, let nb_nb=4 (the number of digits) > for i from 1 to nb_nb, I want the following results: > i=1 => res=1 (first digit of a) and NOT the number 01 (with a zero > in front of the 1) > i=2 => res=2 (same thing) > i=3 => res=3 > i=4 => res=2 > > I tried a few things, like convert the number in array (it seems to > keep the "0" in the result)... > > do you have a solution? > > olivier. > > > > > > > ___________________________________________________________________________ > Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et > son interface révolutionnaire. > http://fr.mail.yahoo.com > >