>Something like this, perhaps (untested):

I needed this too so I just tested it.

>function smart_ucwords($String)
>{
>
>       $ExceptionList = array('the', 'an', 'a'); # should all be in
>lowercase
>
>       $String = ucwords(strtolower(ltrim($String))); # LINE A
>
>       foreach ($ExceptionList as $Word)
>       {
>       $String = eregi_replace("[[:space:]]+$Word[[:space:]]+",
>$Word, $String);
>       }


this line should be more like:
$String = eregi_replace("([[:space:]]+)".$Word."([[:space:]]+)",
"\\1".$Word."\\2", $String);

>       return $String; # LINE B
>
>}

thanks!
- Mark


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to