Req #75108 [Opn]: mb_convert_case lacks ucfirst() mode
Edit report at https://bugs.php.net/bug.php?id=75108&edit=1
ID: 75108
Updated by: kalle@php.net
Reported by: chat dot noir at arcor dot de
Summary: mb_convert_case lacks ucfirst() mode
Status: Open
Type: Feature/Change Request
Package: mbstring related
PHP Version: 7.0.22
Block user comment: N
Private report: N
New Comment:
If added, it might also make sense to implement lcfirst()
Previous Comments:
------------------------------------------------------------------------
[2017-08-23 10:12:18] chat dot noir at arcor dot de
Description:
------------
Three of four ASCII case conversion functions have equivalent modes of mb_convert_case():
1. strtoupper -> MB_CASE_UPPER
2. strtolower -> MB_CASE_LOWER
3. ucwords -> MB_CASE_TITLE
4. ucfirst -> ???
What's with the fourth? Would come in handy when you use some dynamic text at the beginning of
a sentence.
Test script:
---------------
/* example by info at yasarnet dot com */
function capitalize($str, $encoding = 'UTF-8') {
return mb_strtoupper(mb_substr($str, 0, 1, $encoding), $encoding) .
mb_strtolower(mb_substr($str, 1, mb_strlen($str), $encoding), $encoding);
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75108&edit=1
Thread (2 messages)