34 function subStr($a_str, $a_start, $a_length = NULL)
36 if (function_exists(
"mb_substr"))
38 return mb_substr($a_str, $a_start, $a_length,
"UTF-8");
42 return substr($a_str, $a_start, $a_length);
46 function strPos($a_haystack, $a_needle, $a_offset = NULL)
48 if (function_exists(
"mb_strpos"))
50 return mb_strpos($a_haystack, $a_needle, $a_offset,
"UTF-8");
54 return strpos($a_haystack, $a_needle, $a_offset);
81 if (function_exists(
"mb_strlen"))
83 return mb_strlen($a_string,
"UTF-8");
87 return strlen($a_string);
93 if (function_exists(
"mb_strtolower"))
95 return mb_strtolower($a_string,
"UTF-8");
99 return strtolower($a_string);
105 if (function_exists(
"mb_strtoupper"))
107 return mb_strtoupper($a_string,
"UTF-8");
111 return strtoupper($a_string);
122 if (is_object($ilCollator))
145 public static function shortenText($a_string,$a_start_pos,$a_num_bytes,$a_encoding =
'UTF-8')
147 return mb_strcut($a_string, $a_start_pos, $a_num_bytes, $a_encoding);
155 if (function_exists(
"mb_detect_encoding"))
157 if (mb_detect_encoding($a_str,
"UTF-8") ==
"UTF-8")
168 for($i=0; $i<$len; $i++){
171 if(($c >= 254))
return false;
172 elseif($c >= 252) $bits=6;
173 elseif($c >= 248) $bits=5;
174 elseif($c >= 240) $bits=4;
175 elseif($c >= 224) $bits=3;
176 elseif($c >= 192) $bits=2;
178 if(($i+$bits) > $len)
return false;
182 if($b < 128 || $b > 191)
return false;