Re: mb_ucfirst and mb_lcfirst
| From: | Hans Henrik Bergan | Date: | Sun, 28 May 2023 07:33:57 +0000 |
| Subject: | Re: mb_ucfirst and mb_lcfirst | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-120413@lists.php.net to get a copy of this message | ||
I think it would be useful.
For some reason, lots of people on stackoverflow has a hard time
implementing this function in userland:
on https://stackoverflow.com/questions/2517947/ucfirst-function-for-multibyte-character-encodings
there are 10 broken implementations of mb_ucfirst, and 1 correct one
(disclaimer: I only consider my own implementation correct:
https://stackoverflow.com/a/58915632/1067003
and consider every other implementation on the list broken in one way
or another. and i was really surprised that nobody else got it right.)
On Sat, 27 May 2023 at 23:11, Niels Dossche <dossche.niels@gmail.com> wrote:
>
> Hey internals
>
> I recently saw a comment on Reddit about the lack of a multibyte version of ucfirst and
> lcfirst.
> I was surprised to see this is indeed the case.
> I also checked the modes of mb_convert_case: the closest supported one is title case, but
> there's no mode for only handling the first letter.
>
> I have two questions (and some sub-questions):
> Does anyone know if there is a historical reason for this? A quick search on externals.io
> didn't provide something useful.
> Do you think this is useful? If yes, do you think this should be part of mb_convert_case or
> should this be a standalone function?
>
> Kind regards
> Niels
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: https://www.php.net/unsub.php
>