Re: noob question: easiest way to parse an int?



that sounds like it could work. if i divided by 10 twice, and got the
remainder of 930, i would have the "2nd" digit. is there a method that
lets me get the remainder of a number diving into another??


jmcgill wrote:
user wrote:
would the easiest way be to change the int into a string, break the
string up, then give back the interger representation of the digit im
looking for?

I'm pretty sure I'd do something that involves successive integer
divides by 10 although converting to string is not a horrible choice.

.



Relevant Pages

  • Re: a challenge
    ... // if the remainder isn't zero. ... // recursively to convert it to a string ... // of the hundred's digit (there can be only ...
    (alt.lang.asm)
  • Re: a challenge
    ... // if the remainder isn't zero. ... // recursively to convert it to a string ... // of the hundred's digit (there can be only ...
    (alt.lang.asm)
  • Re: primality
    ... depending on the instruction, ... equivalent to dividing it by 10 and using the remainder. ... digit than to do a division. ... converting the number to a string before looking at the ...
    (sci.crypt)
  • Re: primality
    ... as, depending on the instruction, even in a single cycle. ... significant digit than to do a division. ... converting the number to a string before looking ... instead of one division to get the remainder, ...
    (sci.crypt)
  • Re: Conversion of unsigned longs to String
    ... Here is a multiprecision divide. ... The worst case is analogous to dividing a 4 digit number by a 2 ... digit and the remainder will be one or 2 digits. ... ; Register usage here ...
    (comp.lang.java.programmer)