note 100849 deleted from function.mb-convert-case by danbrown

From: Date: Wed, 10 Nov 2010 21:34:49 +0000
Subject: note 100849 deleted from function.mb-convert-case by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-173930@lists.php.net to get a copy of this message
Note Submitter: arayelcode -at- gmail.com ---- Sub-functions related to and used by function titleCase() // Only oddity here was "Y" - based on info here (http://answers.yahoo.com/question/index?qid=20081118115039AApZFuv) // I'm treating it as a vowel in all cases, because it would only NOT be a vowel if it was next to another vowel // and if that happens, then the word has at least that other vowel; so, the end result of this function would be correct function hasVowels($str) { $str = " " . $str; $retVal = stripos($str, "a") || stripos($str, "e") || stripos($str, "i") || stripos($str, "o") || stripos($str, "u") || stripos($str, "y"); return $retVal===true; } // Does word/string have any characters that are numbers (e.g., "P24") - different than "is_numeric()" function hasNums($str) { $len = strlen($str); $hasNums = false; $pos = 0; while ($pos < $len && ! $hasNums) { $c = substr($str, $pos, 1); $hasNums = is_numeric($c); $pos++; } return $hasNums; } // Is word/string completely alphabetic (no numbers, no punctuation, etc.) // Wraps existing PHP function with something more akin to PHP's related functions that determine string content type function isAlpha($str) { return ctype_alpha($str); }

« previous php.notes (#173930) next »