Add Exception if MB support is not available in PHP
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3813 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
@@ -53,6 +53,9 @@ class convert
|
||||
*/
|
||||
public static function ucfirst ($str)
|
||||
{
|
||||
if (! function_exists ("mb_strtoupper"))
|
||||
throw new \Exception ("PHP don't have the MB Support. Please add it !",
|
||||
500);
|
||||
$a = mb_strtoupper (mb_substr ($str, 0, 1, 'UTF-8'), 'UTF-8');
|
||||
return $a . mb_substr ($str, 1, null, 'UTF-8');
|
||||
}
|
||||
@@ -68,6 +71,9 @@ class convert
|
||||
*/
|
||||
public static function ucwords ($str, $delimiters = " \t\r\n\f\v")
|
||||
{
|
||||
if (! function_exists ("mb_strtolower"))
|
||||
throw new \Exception ("PHP don't have the MB Support. Please add it !",
|
||||
500);
|
||||
$str = mb_strtolower ($str, "utf-8");
|
||||
$res = "";
|
||||
foreach (preg_split ("#([".preg_quote ($delimiters)."]+)#", $str, -1,
|
||||
|
||||
Reference in New Issue
Block a user