rfc:mb_ucfirst

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
rfc:mb_ucfirst [2024/02/02 00:58] – Move voting phase youkidearitairfc:mb_ucfirst [2024/03/20 21:13] (current) – Implemented mb_ucfirst and mb_lcfirst youkidearitai
Line 1: Line 1:
 ====== PHP RFC: Multibyte for ucfirst, lcfirst functions, mb_ucfirst mb_lcfirst ====== ====== PHP RFC: Multibyte for ucfirst, lcfirst functions, mb_ucfirst mb_lcfirst ======
-  * Version: 0.1+  * Version: 0.1.2
   * Date: 2024-01-16   * Date: 2024-01-16
   * Author: Author: Yuya Hamada(https://github.com/youkidearitai), youkidearitai@gmail.com   * Author: Author: Yuya Hamada(https://github.com/youkidearitai), youkidearitai@gmail.com
-  * Status: Voting+  * Status: Implemented
   * First Published at: http://wiki.php.net/rfc/mb_ucfirst   * First Published at: http://wiki.php.net/rfc/mb_ucfirst
  
Line 12: Line 12:
 function mb_ucfirst(string $str, ?string $encoding = null): string 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);+    return mb_convert_case(mb_substr($str, 0, 1, $encoding), MB_CASE_TITLE, $encoding) . mb_substr($str, 1, null, $encoding);
 } }
 </code> </code>
Line 32: Line 32:
 function mb_ucfirst(string $string, ?string $encoding = null): string function mb_ucfirst(string $string, ?string $encoding = null): string
 </code> </code>
 +
 +The first character in mb_ucfirst uses Unicode title case.
  
 <code> <code>
Line 43: Line 45:
   * ngày Quốc khánh 2-9 (September 2nd National Day)   * ngày Quốc khánh 2-9 (September 2nd National Day)
   * tiếng Nhật (Japanese)   * tiếng Nhật (Japanese)
 +
 +Another example, In Georgian should uses title case.
 +
 +  * mb_strtoupper("აბგ") (ani bani gani, U+10D0 U+10D1 U+10D2) -> ᲐᲑᲒ(U+1C90 U+1C91 U+1C92)
 +  * mb_strtoupper("lj")(U+01C9) -> "LJ" (U+01C7)
 +
 +Correct case.
 +
 +  * mb_ucfirst("აბგ") -> "აბგ" (U+10D0 U+10D1 U+10D2)
 +  * mb_ucfirst("lj") -> "Lj" (U+01C9 -> U+01C8)
  
 ===== Backward Incompatible Changes ===== ===== Backward Incompatible Changes =====
Line 73: Line 85:
  
 ===== Voting ===== ===== Voting =====
-<doodle title="Multibyte ucfirst and lcfirst function" auth="youkidearitai" voteType="single" closed="false" closeon="2024-02-26T01:00:00Z">+ 
 +<doodle title="Add mb_ucfirst and mb_lcfirst functions" auth="youkidearitai" voteType="single" closed="true" closeon="2024-03-07T00:00:00Z">
    * Yes    * Yes
    * No    * No
rfc/mb_ucfirst.1706835506.txt.gz · Last modified: 2024/02/02 00:58 by youkidearitai