I know, I know, I have a lot of work to do...I shouldn't be doing
this. I did get to play with PCRE regexps here, though...lotsa cool
features over eregs!. Anyway, here's a *** NEW!!! IMPROVED!!! ***
version of smart_ucwords(), that's probably way too much overkill. I
did some quick tests, see
Fabulous. Thanks to Steve and Mark. Exactly what I needed.
Jeff Oien
> >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
> >
> >
>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 ($ExceptionLi
Something like this, perhaps (untested):
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_
http://www.php.net/manual/en/function.ucwords.php
You can read all about the limit of this function, but this is the closest
thing to what you're looking for.
Rick
> Is there a prewritten function for capitalizing the first letter of each
> word in a string except for the common words you would
> Is there a prewritten function for capitalizing the first
> letter of each word in a string except for the common
> words you wouldn't want to capitalize in a title? Like
> Come Learn the Facts From an Industry Leader
None that I've seen.
But it wouldn't be hard to write a function that take
Is there a prewritten function for capitalizing the first letter of each
word in a string except for the common words you wouldn't want
to capitalize in a title? Like
Come Learn the Facts From an Industry Leader
Thanks.
Jeff Oien
--
PHP General Mailing List (http://www.php.net/)
To unsubscrib
7 matches
Mail list logo