Re: Strings

From: Date: Thu, 26 Oct 2000 18:23:09 +0000
Subject: Re: Strings
Groups: php.general 
Request: Send a blank email to php-general+get-22183@lists.php.net to get a copy of this message
I'm not sure is it the one u want or would say easy. But this is just a javascript function. Or maybe u can modify a bit to suit your requirement. function check_char2(parStr) { var parCount = 0; for (parCount=0; parCount < parStr.length; parCount++) { var varCh = parStr.charAt(parCount); if(character(varCh)) { return true; } } return false; } function character(parChar) { var charArray = new Array( 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '1','2','3','4','5','6','7','8','9','0','.','_'); for (j = 0; j < charArray.length; j++) if (parChar == charArray[j]) return false; return true; } --- Jan van Schaijk <beethoven@hetnet.nl> wrote: > Hi, > > I want to test if a string contains > > a) Characters like a-z or A-Z and > b) numbers like 0-9... > > Is there a function that can do this easily? > > Jan > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: > php-general-unsubscribe@lists.php.net > For additional commands, e-mail: > php-general-help@lists.php.net > To contact the list administrators, e-mail: > php-list-admin@lists.php.net > __________________________________________________ Do You Yahoo!? Yahoo! Messenger - Talk while you surf! It's FREE. http://im.yahoo.com/

« previous php.general (#22183) next »