note 94227 added to function.ucfirst
| From: | pahan | Date: | Fri, 23 Oct 2009 13:00:51 +0000 |
| Subject: | note 94227 added to function.ucfirst | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-162013@lists.php.net to get a copy of this message | ||
UTF-8 variant is sibple through mb_strtoupper:
/**
* Unicode variant of ucfirst!
* Idea got from http://php.net/manual/en/function.ucfirst.php#87133
but its implementation
* is very long and hard without reason.
*
* @uses mb_strtoupper
* @param string $str String to process
* @param string=UTF-8 $enc
* @return string
**/
function unicode_ucfirst($str, $enc = 'UTF-8'){
return preg_replace('/^./ue', "mb_strtoupper('\\0',
'$enc')", $str);
}#f unicode_ucfirst
?>
----
Server IP: 78.41.104.8
Probable Submitter: 195.182.129.150
----
Manual Page -- http://www.php.net/manual/en/function.ucfirst.php
Edit -- https://master.php.net/note/edit/94227
Del: integrated -- https://master.php.net/note/delete/94227/integrated
Del: useless -- https://master.php.net/note/delete/94227/useless
Del: bad code -- https://master.php.net/note/delete/94227/bad+code
Del: spam -- https://master.php.net/note/delete/94227/spam
Del: non-english -- https://master.php.net/note/delete/94227/non-english
Del: in docs -- https://master.php.net/note/delete/94227/in+docs
Del: other reasons-- https://master.php.net/note/delete/94227
Reject -- https://master.php.net/note/reject/94227
Search -- https://master.php.net/manage/user-notes.php