Results 1 to 2 of 2
  1. #1
    lithium002 is offline Member
    Join Date
    Nov 2009
    Posts
    23
    Rep Power
    0

    Default Counting digits in an integer value, including zero

    Hello,

    I'm curious if this is possible at all.

    Imagine if a user enters the number 00005 from his keyboard, and we were to count all the digits, including zeros, in this number, how would we go about doing it?

    I see that any value entered from the keyboard that includes a zero in the beginning automatically cuts off.

    How can I prevent this?

  2. #2
    lobodelbosque is offline Member
    Join Date
    Nov 2009
    Posts
    12
    Rep Power
    0

    Default

    i think saving the number as a string, and then count the zeros.

    you can pass the number from string to int with parseInt() method.

Similar Threads

  1. Replies: 3
    Last Post: 08-19-2009, 04:54 AM
  2. split() by digits
    By RobertF in forum New To Java
    Replies: 2
    Last Post: 03-12-2009, 03:16 AM
  3. sum of digits depreciation
    By jleas in forum New To Java
    Replies: 13
    Last Post: 11-09-2008, 02:37 PM
  4. Including JAR in applications
    By bugger in forum New To Java
    Replies: 0
    Last Post: 01-11-2008, 10:36 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •