check length on a integer variable?

I have a declared
[code]int IntLength=1234;[/code]

how can i check the length on this, how many letters there are?

you can use .length on string variables, but cant find out how do make it work on a integer.

sincerely h


  • [code]int intLenght=1234;
    System.out.println("The length:" + String.valueOf(intLenght).trim().length());

    Convert to a string, trim the leading and trailing spaces, then get the length of such string.
    [red]Good luck![/red]
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion