From 7d6cac54f36832f25fb52635c027ae99202082a8 Mon Sep 17 00:00:00 2001 From: paca70 Date: Mon, 21 Apr 2003 16:39:43 +0000 Subject: [PATCH] New string conversion function to help with multibyte-locales --- lib/moodlelib.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 8f48d9e0e8..9cca4478d9 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -1253,6 +1253,19 @@ function moodle_needs_upgrading() { /// MISCELLANEOUS //////////////////////////////////////////////////////////////////// +function moodle_strtolower ($string, $encoding='') { +/// Converts string to lowercase using most compatible function available + if (function_exists('mb_strtolower')) { + if($encoding===''){ + return mb_strtolower($string); //use multibyte support with default encoding + } else { + return mb_strtolower($string,encoding); //use given encoding + } + } else { + return strtolower($string); // use common function what rely on current locale setting + } +} + function count_words($string) { /// Words are defined as things between whitespace $string = strip_tags($string); -- 2.39.5