Multibyte for ucfirst function
| From: | youkidearitai | Date: | Sat, 06 Jan 2024 02:53:16 +0000 |
| Subject: | Multibyte for ucfirst function | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-122131@lists.php.net to get a copy of this message | ||
Hi, Internals
We got feature request for "Multibyte for ucfirst function".
https://github.com/php/php-src/issues/13075
I think make sense for implement this function, but I don't know well
about not-latin language.
I have a question.
gnutix san pick up sample to below:
https://stackoverflow.com/questions/2517947/ucfirst-function-for-multibyte-character-encodings/58915632#58915632
```
function mb_ucfirst(string $str, ?string $encoding = null): string
{
return mb_strtoupper(mb_substr($str, 0, 1, $encoding), $encoding)
. mb_substr($str, 1, null, $encoding);
}
```
mb_strtoupper supports not-latin language, Therefore, that means
effect ucfirst not-latin language.
Manual of mb_strtoupper is shows example #2 not-latin language.
https://www.php.net/manual/en/function.mb-strtoupper.php#refsect1-function.mb-strtoupper-examples
What do we think? Feel free to comment.
Cheers for new year.
Yuya
--
---------------------------
Yuya Hamada (tekimen)
- https://tekitoh-memdhoi.info
- https://github.com/youkidearitai
-----------------------------