From 19a60471bc48f5e7fd72748f658181186610d5b2 Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Fri, 5 May 2017 18:35:14 +0000 Subject: [PATCH] Add ucfirst UTF8 git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3601 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- convert.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/convert.php b/convert.php index 9a02ddb..e685681 100644 --- a/convert.php +++ b/convert.php @@ -46,4 +46,14 @@ class convert } return $date->format ($outputFormat); } + + /** Convert the first char to capital and the rest of the sentence in + * lowercase (like ucfirst, but UTF8 compliant + * @param string $str The string to convert + */ + public static function ucfirst ($str) + { + $a = mb_strtoupper (mb_substr ($str, 0, 1, 'UTF-8'), 'UTF-8'); + return $a . mb_substr ($str, 1, null, 'UTF-8'); + } }