From: "Jörg W Mittag" Date: 2010-09-19T02:45:12+09:00 Subject: Re: converting number to its digits as an array Ian Ian wrote: > I'm new to ruby and I was trying to solve a problem where I convert a > number into an array in such a way. > > If I have the number 12345, how do I take that number and put it into an > array but where each element is a digit of the number 12345? There's a myriad ways to do that. I find this one the simplest, easiest to read and easiest to understand: 12345.to_s.chars.map(&:to_i) jwm