SA-MP Forums Archive
Convert string - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Convert string (/showthread.php?tid=614803)



Convert string - MerryDeer - 13.08.2016

Hi,

I have string where is stored data like 2016-8-13, but i want to convert it with 0, that 2016-08-13 would be 0 - 00 - 1 - 01 and so on..


Re: Convert string - Stinged - 13.08.2016

Use %02i


Re: Convert string - MerryDeer - 13.08.2016

Yes, but i have string and i from it get data and convert to 02i


Re: Convert string - Konstantinos - 13.08.2016

pawn Код:
new string[12] = "2016-8-13", year, month, day;
sscanf(string, "p<->iii", year, month, day);
   
format(string, sizeof string, "%i-%02i-%02i", year, month, day);
print(string);
// Prints: "2016-08-13"