On 2/14/08, Thomas Preymesser <thopre / gmail.com> wrote:
> On 13/02/2008, Adam Akhtar <adamtemporary / gmail.com> wrote:
> >
> >
> >   numdigits = 1
> >   x = 1
> >   while (x < totalnumlines)
> >     x = x * 10
> >     numdigits = numdigits + 1
> >   end
>
>
> you don't need such a loop. this can be replaced with
>
>  numdigits = Math.log10(totalnumlines).to_i+1
>
Hint:
why do math to calculate how many digits it takes to represent a
number as a string, when you can just let the String class  tell you?