On Wednesday 29 May 2002 11:06, Randy Janinda wrote: > Hello everyone, > > I have a script to check a user submitted string. It may be multiple > words. If a word is found to be 3 characters or less, the script should > retain the case of the string IF all the characters are uppercase. > Otherwise, the script will make the first character of each word > uppercase. So "Main st" becomes "Main St" and "Main st NB" becomes "Main > St NB". Easy enough right? > > So take a look and let me know if this is a bug or feature. > > Here's the chunk of code and you can test it in action at > http://www.tqlabs.com/testcase.php (and .phps accordingly): > > if ($MyString) { > $safeInfo = explode(" ",strip_tags(stripslashes(trim($MyString)))); > foreach($safeInfo as $strTok) { > print "Checking: $strTok<BR>"; > if (strlen($strTok) <= 3) { > $case = preg_match_all("/[A-Z]/",$strTok,$junk); > $count = strlen($strTok); > > /////////////////////////////////////// > // Why won't this work?!?!?! > /////////////////////////////////////// > if (preg_match_all("[A-Z]",$strTok,$junk) == strlen($strTok)) {
Is this a typo? Shouldn't it be the same as above with the '/' delimiters? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php