-
hi,
how would i get the last 4 digits of a 7 digit number.
would love some help on this.
cheers.
mydo
-
Senior Member
Hi,
This will get the last 4 digits of a number of any length
digitsWanted = 4; // how many digits should be found
number = 8675252; // random 7 digit number to test
number = number.toString();
len = number.length; // how many digits in the number
start = len - digitsWanted;
lastDigits = number.substr(start, digitsWanted);
trace(lastDigits); // in this case displays 5252
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|