note 16551 added to function.ucwords
| From: | Julienc at psychologie-fr dot com | Date: | Sun, 04 Nov 2001 00:06:12 +0000 |
| Subject: | note 16551 added to function.ucwords | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-20404@lists.php.net to get a copy of this message | ||
Its still possible to clean a bit more the previous sample:
$string=strtolower($string); $break=true;
for ($i=0; $i < strlen($string); $i++) { $subed=$string[$i];
if (((ord($subed) > 64) && (ord($subed) < 123)) || ((ord($subed) > 48) &&
(ord($subed) < 58))) {
if ($break) { $string[$i] = strtoupper($subed); }
$break=false; } else { $break=true; }
}
- Julien
--
http://www.php.net/manual/en/function.ucwords.php
http://master.php.net/manage/user-notes.php?action=edit+16551
http://master.php.net/manage/user-notes.php?action=delete+16551
http://master.php.net/manage/user-notes.php?action=reject+16551