From: Jim Freeze Date: 2009-02-24T07:20:26+09:00 Subject: [ruby-core:22388] Re: Proposal: Integer.digit_count --00221532cba0da694404639d5427 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit abs.to_s.size On Mon, Feb 23, 2009 at 4:07 PM, Kurt Stephens wrote: > -1.digit_count : is '-' a digit? Fixnum#log10 anyone? > > Yehuda Katz wrote: > > What's the use-case for this being in the language? It's damn easy to write > ruby-method for it: > > class Integer > def digit_count > to_s.size > end > end > > 2009/2/23 Varun Gupta > >> How about having a method to return number of digits in the Integer? >> >> eg. >> >> 36420.digit_count => 5 >> >> Regards, >> Varun Gupta >> > > > > -- > Yehuda Katz > Developer | Engine Yard > (ph) 718.877.1325 > > > -- Jim Freeze --00221532cba0da694404639d5427 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable abs.to_s.size

On Mon, Feb 23, 2009 at 4:0= 7 PM, Kurt Stephens <kurt@cashnetusa.com> wrote:
=20
-1.digit_count : is '-' a digit?  Fixnum#log10 anyone?

Yehuda Katz wrote:
What's the use-case for this being in the lan= guage? It's damn easy to write ruby-method for it:

class Integer
  def digit_count
    to_s.size
  end
end

2009/2/23 Varun Gupta <thevarungupta@gm= ail.com>
How about having a method to return number of digits in the Integer?

eg.

36420.digit_count =3D> 5

Regards,
Varun Gupta



--
Yehuda Katz
Developer | Engine Yard
(ph) 718.877.1325




--
Jim Freeze
--00221532cba0da694404639d5427--