Re: [PHP-DEV] mb_ucfirst and mb_lcfirst

2023-05-28 Thread Hans Henrik Bergan
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  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
>

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php



[PHP-DEV] mb_ucfirst and mb_lcfirst

2023-05-27 Thread Niels Dossche
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