Re: ucwords() vs title case
| From: | Tjerk Meesters | Date: | Mon, 30 Jun 2014 11:54:58 +0000 |
| Subject: | Re: ucwords() vs title case | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-75140@lists.php.net to get a copy of this message | ||
Hi internals,
I came across this old bug: https://bugs.php.net/bug.php?id=34407
The desired behaviour for that particular person:
"the (world) now" => "The (World) Now"
Currently PHP adopts a very simple rule:
1. Capitalise first character (no matter what it is)
2. Capitalise character preceded by a space, tab, etc.
Using string.title() from Python you'd get the expected behaviour; they use:
1. Capitalise first letter of a word
2. Lowercase subsequent letters of a word
3. Non-letters delimit words
Personally I find that the latter is too much of a departure from what we
currently have; a compromise could be to treat punctuation as a word
delimiter.
Thoughts?
--
--
Tjerk