[PLUG] RE: [PJUG Javamail] OT: Formula For Determining # Of Digits In A n Integer

Loren Delamarter ldelamar at northpacific.com
Fri Feb 18 00:39:52 UTC 2005


Jason,
How can you have leading zeros in an int or Integer?
If it's a literal with a leading zero it will be taken as octal.
My vote is for the ...toString().length() method!
-Loren


-----Original Message-----
From: javamail-admin at pjug.org [mailto:javamail-admin at pjug.org] On Behalf Of
Jason Van Cleve
Sent: Thursday, February 17, 2005 1:55 PM
To: plug at lists.pdxlinux.org; javamail at pjug.org; euglug-bounces at euglug.org
Subject: [PJUG Javamail] OT: Formula For Determining # Of Digits In An
Integer


Hi,

I know many of you folks are advanced in mathematics.  I need a formula that
will take an integer and return the number of its digits:

3	--> 1
25	--> 2
52341	--> 5
032	--> 2 (ignore leading 0's)

Any ideas?

--Jason

--
Emacs is a great operating system.  The only thing it lacks is a good text
editor. _______________________________________________
Web Site - http://www.pjug.org/
Javamail mailing list
Javamail at pjug.org
http://www.pjug.org/mailman/listinfo/javamail



More information about the PLUG mailing list