Getting length of an integer?
#1

How can I get the length of an integer? I am trying to make a system to generate a random 7 digit phone number, and I am planning to use something like this:
pawn Код:
new randnum;
while (intlen(randnum) != 7) {
       randnum = random(9999999);
}
PlayerData[playerid][PhoneNumber] = randnum;
But I can't find a function to calculate the length of the value though.

(My while loop could be wrong, too, it is meant to keep generating random numbers until it hits a 9 digit one, and then set the player's phone number to that - am I doing it right?)
Reply


Messages In This Thread
Getting length of an integer? - by jameskmonger - 11.07.2011, 21:46
Re: Getting length of an integer? - by Roko_foko - 11.07.2011, 22:00
Re: Getting length of an integer? - by jameskmonger - 11.07.2011, 22:01
Re: Getting length of an integer? - by Macluawn - 11.07.2011, 22:06
Re: Getting length of an integer? - by Shadoww5 - 11.07.2011, 22:07
Re: Getting length of an integer? - by jameskmonger - 11.07.2011, 22:11
Re: Getting length of an integer? - by Jefff - 11.07.2011, 22:15
Re: Getting length of an integer? - by RyDeR` - 11.07.2011, 22:17
Re: Getting length of an integer? - by Shadoww5 - 12.07.2011, 01:52
Re: Getting length of an integer? - by Calgon - 12.07.2011, 03:08

Forum Jump:


Users browsing this thread: 2 Guest(s)