Re: Re: ucwords() vs title case

From: Date: Mon, 30 Jun 2014 12:36:29 +0000
Subject: Re: Re: ucwords() vs title case
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-75143@lists.php.net to get a copy of this message
2014-06-30 13:54 GMT+02:00 Tjerk Meesters <tjerk.meesters@gmail.com>: > 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 > Actually letting a function "uppercase first (letter)" lowercase all subsequent would be even more unexpected. > 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 > -- github.com/KingCrunch

« previous php.internals (#75143) next »