15 static public function subStr($a_str, $a_start, $a_length = NULL)
17 if (function_exists(
"mb_substr"))
21 if ($a_length === null)
23 $a_length = mb_strlen($a_str,
"UTF-8");
26 return mb_substr($a_str, $a_start, $a_length,
"UTF-8");
30 return substr($a_str, $a_start, $a_length);
34 static function strPos($a_haystack, $a_needle, $a_offset = NULL)
36 if (function_exists(
"mb_strpos"))
38 return mb_strpos($a_haystack, $a_needle, $a_offset,
"UTF-8");
42 return strpos($a_haystack, $a_needle, $a_offset);
46 static function strrPos($a_haystack, $a_needle, $a_offset = NULL)
48 if (function_exists(
"mb_strpos"))
50 return mb_strrpos($a_haystack, $a_needle, $a_offset,
"UTF-8");
54 return strrpos($a_haystack, $a_needle, $a_offset);
58 static function strIPos($a_haystack, $a_needle, $a_offset = NULL)
60 if (function_exists(
"mb_stripos"))
62 return mb_stripos($a_haystack, $a_needle, $a_offset,
"UTF-8");
66 return stripos($a_haystack, $a_needle, $a_offset);
91 static public function strLen($a_string)
93 if (function_exists(
"mb_strlen"))
95 return mb_strlen($a_string,
"UTF-8");
99 return strlen($a_string);
105 if (function_exists(
"mb_strtolower"))
107 return mb_strtolower($a_string,
"UTF-8");
111 return strtolower($a_string);
117 $a_string = (
string) $a_string;
118 if (function_exists(
"mb_strtoupper"))
120 return mb_strtoupper($a_string,
"UTF-8");
124 return strtoupper($a_string);
135 if (is_object($ilCollator))
158 static public function shortenText($a_string,$a_start_pos,$a_num_bytes,$a_encoding =
'UTF-8')
160 if (function_exists(
"mb_strcut"))
162 return mb_strcut($a_string, $a_start_pos, $a_num_bytes, $a_encoding);
164 return substr($a_string, $a_start_pos, $a_num_bytes);
172 if (function_exists(
"mb_detect_encoding"))
174 if (mb_detect_encoding($a_str,
"UTF-8",
true) ==
"UTF-8")
185 for($i=0; $i<$len; $i++){
188 if(($c >= 254))
return false;
189 elseif($c >= 252) $bits=6;
190 elseif($c >= 248) $bits=5;
191 elseif($c >= 240) $bits=4;
192 elseif($c >= 224) $bits=3;
193 elseif($c >= 192) $bits=2;
195 if(($i+$bits) > $len)
return false;
199 if($b < 128 || $b > 191)
return false;
217 static public function strPosAll($a_haystack, $a_needle)
219 $positions =
array();
221 while(is_int($pos = strpos($a_haystack, $a_needle, $cpos)))
234 if (is_int(strpos($a_str, $a_old)))
236 $a_str = substr_replace ($a_str, $a_new, strpos($a_str, $a_old), strlen($a_old));
248 return strtolower(preg_replace(
249 array(
'#(?<=(?:[A-Z]))([A-Z]+)([A-Z][A-z])#',
'#(?<=(?:[a-z0-9]))([A-Z])#'),
250 array(
'\1_\2',
'_\1'),
266 for($i = 0; $i < strlen($a_str); $i++)
268 $bytes[] = ord($a_str[$i]);
281 include_once(
"./include/Unicode/UtfNormal.php");
static shortenText($a_string, $a_start_pos, $a_num_bytes, $a_encoding='UTF-8')
Shorten text to the given number of bytes.
static strrPos($a_haystack, $a_needle, $a_offset=NULL)
static convertUpperCamelCaseToUnderscoreCase($value)
Convert a value given in camel case conversion to underscore case conversion (e.g.
static normalizeUtf8String($a_str)
Normalize UTF8 string.
static strPos($a_haystack, $a_needle, $a_offset=NULL)
Add rich text string
The name of the decorator.
static strToLower($a_string)
Multi byte sensitive string functions.
static toNFC( $string)
Convert a UTF-8 string to normal form C, canonical composition.
static getBytesForString($a_str)
Return string as byte array Note: Use this for debugging purposes only.
Create styles array
The data for the language used.
static strToUpper($a_string)
static strIPos($a_haystack, $a_needle, $a_offset=NULL)
static subStr($a_str, $a_start, $a_length=NULL)
static strCmp($a, $b)
Compare two strings.
static strPosAll($a_haystack, $a_needle)
Get all positions of a string.
static replaceFirsOccurence($a_old, $a_new, $a_str)
Replaces the first occurence of $a_old in $a_str with $a_new.
static isUtf8($a_str)
Check whether string is utf-8.