Integers
#1

Hey, how can I replace my integer '6' with '06' in strings?
Reply
#2

like this
pawn Код:
new integer = 6,string[10];
format(string, sizeof(string), "0%i", integer);
Reply
#3

Something like that. But for example about seconds? If integer is one (5 or 7), your example is right, but if there are two integers (26 or 45), then integer would be 026 or 045.
Reply
#4

like this then
pawn Код:
if(integer>=0 && integer < 10)format(string, sizeof(string), "0%i", integer);
else format(string, sizeof(string), "%i", integer);
Reply
#5



pawn Код:
%02d
Reply
#6

Thanks for both of you.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)