Only words
#7

this is a better one
Код:
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;
}
Reply


Messages In This Thread
Only words - by Dws - 23.06.2010, 18:02
Re: Only words - by Hiddos - 23.06.2010, 18:20
Re: Only words - by Backwardsman97 - 23.06.2010, 18:23
Re: Only words - by dice7 - 23.06.2010, 18:25
Re: Only words - by Dws - 23.06.2010, 18:27
Re: Only words - by dice7 - 23.06.2010, 18:28
Re: Only words - by (SF)Noobanatior - 23.06.2010, 18:31
Re: Only words - by dice7 - 23.06.2010, 18:37
Re: Only words - by Dws - 23.06.2010, 18:44

Forum Jump:


Users browsing this thread: 1 Guest(s)