RE: [PHP] ucwords Except 'The' 'And' etc?

2001-08-14 Thread Steve Edberg
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,

RE: [PHP] ucwords Except 'The' 'And' etc?

2001-08-13 Thread Boget, Chris
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 takes a

Re: [PHP] ucwords Except 'The' 'And' etc?

2001-08-13 Thread Richard Baskett
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

RE: [PHP] ucwords Except 'The' 'And' etc?

2001-08-13 Thread Steve Edberg
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 =

RE: [PHP] ucwords Except 'The' 'And' etc?

2001-08-13 Thread Mark Maggelet
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

RE: [PHP] ucwords Except 'The' 'And' etc?

2001-08-13 Thread Jeff Oien
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 $String =