Splitting numbers.
#5

What? Why would it be necessary to convert it to string first and then convert it back? This solves all your problems:

pawn Код:
new LastDigit = number % 10;
Edit: To get the left part you would subtract the LastDigit from the orginal number and then divide by 10. Ex:

pawn Код:
1222 % 10 = 2
(1222 - 2) / 10 = 1220 / 10 = 122
Reply


Messages In This Thread
Splitting numbers. - by Roel - 16.05.2013, 08:57
Re: Splitting numbers. - by [HiC]TheKiller - 16.05.2013, 09:02
Re: Splitting numbers. - by Emmet_ - 16.05.2013, 09:08
Re: Splitting numbers. - by Roel - 16.05.2013, 09:10
Re: Splitting numbers. - by Vince - 16.05.2013, 09:59
Re: Splitting numbers. - by Roel - 16.05.2013, 10:19

Forum Jump:


Users browsing this thread: 1 Guest(s)