[Tutorial] String Formatting
#8

Quote:
Originally Posted by krogsgaard20
View Post
An array is memory that can be accessed dynamically, and unused arrays will cause CPU lagg on the server.
I don't think they cause CPU lag. They just consume more RAM and it takes longer for your script to compile.

And I think you should also have explained a little about the other format placeholders. More often that not, I see people doing something like:

pawn Code:
if(minute <= 9)
{
    format(string, sizeof(string), "0%d", minute)
}
else
{
    format(string, sizeof(string), "%d", minute)
}
While you could just as easily write that in a single line using:

pawn Code:
format(string, sizeof(string), "%02d", minute);
Which will make sure the placeholder is 2 digits long and which will also pad it with zeros if it's not.
Reply


Messages In This Thread
String Formatting - by krogsgaard20 - 30.06.2011, 22:55
Re: String Formatting - by grand.Theft.Otto - 01.07.2011, 03:29
Re: String Formatting - by dr.pepper - 01.07.2011, 03:34
Re: String Formatting - by krogsgaard20 - 01.07.2011, 09:34
Re: String Formatting - by Toreno - 01.07.2011, 10:47
Re: String Formatting - by iPLEOMAX - 01.07.2011, 11:05
Re: String Formatting - by Lorenc_ - 01.07.2011, 11:08
Re: String Formatting - by Vince - 01.07.2011, 11:24
Re: String Formatting - by Macluawn - 01.07.2011, 11:25
Re: String Formatting - by krogsgaard20 - 01.07.2011, 15:45
Re: String Formatting - by Mean - 03.07.2011, 17:02
Re: String Formatting - by Calgon - 03.07.2011, 17:03
Re: String Formatting - by Mean - 03.07.2011, 17:14
Re: String Formatting - by [03]Garsino - 03.07.2011, 17:49
Re: String Formatting - by sim_sima - 03.07.2011, 22:22
Re: String Formatting - by [03]Garsino - 03.07.2011, 22:34
Re: String Formatting - by sim_sima - 04.07.2011, 11:15
Re: String Formatting - by cessil - 05.07.2011, 02:35
Re: String Formatting - by SchurmanCQC - 05.07.2011, 02:50
Re: String Formatting - by krogsgaard20 - 05.07.2011, 13:23
Re: String Formatting - by sim_sima - 06.08.2011, 12:32
Re: String Formatting - by sim_sima - 20.10.2011, 20:51
Re: String Formatting - by krogsgaard20 - 08.01.2012, 15:52
Re: String Formatting - by Jessyy - 21.07.2012, 18:49
Re: String Formatting - by cazanova - 26.07.2012, 04:57
Re: String Formatting - by Amit_B - 26.07.2012, 08:33
Re: String Formatting - by Vince - 26.07.2012, 09:23
Re: String Formatting - by Kaperstone - 26.07.2012, 09:40
Re: String Formatting - by Amit_B - 26.07.2012, 10:22
Re: String Formatting - by Madsen - 31.03.2013, 21:54
Re: String Formatting - by ZcvDev - 01.02.2015, 03:46
Re: String Formatting - by JasonRiggs - 27.01.2017, 01:35
Re: String Formatting - by BlackbirdXd - 15.02.2017, 13:19
Re: String Formatting - by RoW001 - 20.03.2017, 17:11
Re: String Formatting - by Eoussama - 15.12.2017, 12:13

Forum Jump:


Users browsing this thread: 1 Guest(s)