2010/9/21 Timothy Baron <timothy.baron / gmail.com>

> Here's a simple question:  What's an effecient way to get the digits of
> a number.  For instance, if I have the number 37, how can I get "3" and
> "7"?
>
I'm not sure about the efficiency but this can do:
number.to_s.split(//)
Ex: 1464002.to_s.split(//) =3D> ["1", "4", "6", "4", "0", "0", "2"]

Otherwise, you may need to derive a method of your own. :-)


---
Edmond
Software Developer | Baobab Health Trust (http://www.baobabhealth.org/) |
Malawi

Cell:  +265 999 465 137 | +265 881 234 717

*"Many people doubt open source software and probably don=92t realize that
there is an alternative=85 which is just as good.." -- Kevin Scannell*