note 108700 added to function.ucfirst
| From: | idont at remember dot it | Date: | Fri, 18 May 2012 11:21:04 +0000 |
| Subject: | note 108700 added to function.ucfirst | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-188057@lists.php.net to get a copy of this message | ||
In case you need a French version of ucfirst:
"été indien" => "Eté indien"
"ça va?" => "Ãa va?"
function frenchUcfirst($v) {
$lowCase = "\xE0\xE1\xE2\xE3\xE4\xE5\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF";
$lowCase .= "\xF1\xF2\xF3\xF4\xF5\xF6\xF8\xF9\xFA\xFB\xFC\xFD\xFF\u0161";
$upperCase = "AAAAAA\xC7EEEEIIIINOOOOOOUUUUYYS";
return strtoupper(strtr(substr($v, 0, 1), $lowCase, $upperCase)) . substr($v, 1);
}
Note:
- Latin non french accented characters follow the same rule:
"ändå" => "Andå"
- Non ASCII characters in the function are in HEX format to avoid encoding issue...
----
Server IP: 62.2.182.223
Probable Submitter: 62.202.13.17
----
Manual Page -- http://www.php.net/manual/en/function.ucfirst.php
Edit -- https://master.php.net/note/edit/108700
Del: integrated -- https://master.php.net/note/delete/108700/integrated
Del: useless -- https://master.php.net/note/delete/108700/useless
Del: bad code -- https://master.php.net/note/delete/108700/bad+code
Del: spam -- https://master.php.net/note/delete/108700/spam
Del: non-english -- https://master.php.net/note/delete/108700/non-english
Del: in docs -- https://master.php.net/note/delete/108700/in+docs
Del: other reasons-- https://master.php.net/note/delete/108700
Reject -- https://master.php.net/note/reject/108700
Search -- https://master.php.net/manage/user-notes.php