note 75051 deleted from function.ucwords by nlopess
| From: | nlopess@php.net | Date: | Sat, 12 May 2007 11:29:47 +0000 |
| Subject: | note 75051 deleted from function.ucwords by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-126445@lists.php.net to get a copy of this message | ||
Note Submitter: nep at udaff dot com
----
УнивеÑÑалÑÐ½Ð°Ñ ÑÑнкÑиÑ, по
поднÑÑÐ¸Ñ Ð¿ÐµÑвÑÑ
бÑкв
каждого Ñлова, в веÑÑ
ний
ÑегиÑÑÑ. ÐÑÑÑ Ñлова
иÑклÑÑÐµÐ½Ð¸Ñ (аÑÑикли).
ÐоÑикÑÐµÐ½Ñ Ð±Ð°Ð³Ð¸ Ñ
ÑкÑаниÑованием и поднÑÑием
бÑкв поÑле кавÑÑек.
function ucsmart($str) {
$all_lowercase="A|An|And|At|For|In|Of|On|Or|The|To|With";
$str=ucfirst(preg_replace("/\\b($all_lowercase)\\b/e",
'strtolower("$1")', ucwords(strtolower($str))));
$str=preg_replace('/([^a-z])([\'"\(\[][a-z0-9])/e',
'"$1".strtoupper("$2")',$str);
return str_replace("\'", "'", $str);
}
Hi from Russian :)