Skip to content

Commit

Permalink
New string conversion function to help with multibyte-locales
Browse files Browse the repository at this point in the history
  • Loading branch information
paca70 committed Apr 21, 2003
1 parent 3ba2985 commit 7d6cac5
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/moodlelib.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1253,6 +1253,19 @@ function moodle_needs_upgrading() {


/// MISCELLANEOUS //////////////////////////////////////////////////////////////////// /// 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) { function count_words($string) {
/// Words are defined as things between whitespace /// Words are defined as things between whitespace
$string = strip_tags($string); $string = strip_tags($string);
Expand Down

0 comments on commit 7d6cac5

Please sign in to comment.