Multibyte for ucfirst function

php.internals

youkidearitai

2 years ago
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 -----------------------------

Gina P. Banyard

2 years ago
On Saturday, 6 January 2024 at 02:53, youkidearitai <youkidearitai@gmail.com> wrote:
> Hi, Internals > > We got feature request for "Multibyte for ucfirst function". > https://github.com/php/php-src/issues/13075
There was already a small thread about this last year: https://externals.io/message/120409 I think it makes sense to add this in general. Best regards, Gina P. Banyard

youkidearitai

2 years ago
Hi, Internals I'm try creating a new RFC that add mb_ucfirst and mb_lcfirst functions. Draft is here: https://github.com/php/php-src/issues/13075#issuecomment-1893012382 If any wrong, please feel free comment. Cheers Yuya
-- --------------------------- Yuya Hamada (tekimen) - https://tekitoh-memdhoi.info - https://github.com/youkidearitai -----------------------------

youkidearitai

2 years ago
Hi, Internals I have been create an RFC: https://wiki.php.net/rfc/mb_ucfirst Please feel free comment. Regards Yuya
-- --------------------------- Yuya Hamada (tekimen) - https://tekitoh-memdhoi.info - https://github.com/youkidearitai -----------------------------