SA-MP Forums Archive
isnumeric - 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: isnumeric (/showthread.php?tid=415891)



isnumeric - speed258 - 15.02.2013

Код:
stock IsNumeric(const string[])
{
	for (new i = 0, j = strlen(string); i < j; i++)
	{
    	if (string[i] > '9' || string[i] < '0') return 0;
	}
	return 1;
}
how make this code to check float numbers?


Re: isnumeric - Vince - 15.02.2013

Use sscanf.

pawn Код:
return !sscanf(string, "{f}");



Re: isnumeric - speed258 - 15.02.2013

Quote:

stock IsNumeric(const string[])
{
return !sscanf(string, "{f}")
}

correct?