4 symbols.
#2

do you want to know if a player types a string are they all numbers?

Код:
stock isNumeric(const string[]) {
	new length=strlen(string);
	if (length==0) return false;
	for (new i = 0; i < length; i++) {
		if (
		(string[i] > '9' || string[i] < '0' && string[i]!='-' && string[i]!='+') // Not a number,'+' or '-'
		|| (string[i]=='-' && i!=0)                       // A '-' but not at first.
		|| (string[i]=='+' && i!=0)                       // A '+' but not at first.
		) return false;
	}
	if (length==1 && (string[0]=='-' || string[0]=='+')) return false;
	return true;
}
NOTE: thanks Dracoblue
Reply


Messages In This Thread
4 symbols. - by DyDy - 23.06.2010, 07:21
Re: 4 symbols. - by (SF)Noobanatior - 23.06.2010, 07:24
Re: 4 symbols. - by DyDy - 23.06.2010, 07:26
Re: 4 symbols. - by DyDy - 23.06.2010, 07:46
Re: 4 symbols. - by (SF)Noobanatior - 23.06.2010, 07:48
Re: 4 symbols. - by DyDy - 23.06.2010, 07:53
Re: 4 symbols. - by (SF)Noobanatior - 23.06.2010, 08:00

Forum Jump:


Users browsing this thread: 1 Guest(s)