15    public static function subStr($a_str, $a_start, $a_length = 
null)
 
   17        if (function_exists(
"mb_substr")) {
 
   20            if ($a_length === 
null) {
 
   21                $a_length = mb_strlen($a_str, 
"UTF-8");
 
   24            return mb_substr($a_str, $a_start, $a_length, 
"UTF-8");
 
   26            return substr($a_str, $a_start, $a_length);
 
   30    public static function strPos($a_haystack, $a_needle, $a_offset = 
null)
 
   32        if (function_exists(
"mb_strpos")) {
 
   33            return mb_strpos($a_haystack, $a_needle, $a_offset, 
"UTF-8");
 
   35            return strpos($a_haystack, $a_needle, $a_offset);
 
   39    public static function strrPos($a_haystack, $a_needle, $a_offset = 
null)
 
   41        if (function_exists(
"mb_strpos")) {
 
   42            return mb_strrpos($a_haystack, $a_needle, $a_offset, 
"UTF-8");
 
   44            return strrpos($a_haystack, $a_needle, $a_offset);
 
   48    public static function strIPos($a_haystack, $a_needle, $a_offset = 
null)
 
   50        if (function_exists(
"mb_stripos")) {
 
   51            return mb_stripos($a_haystack, $a_needle, $a_offset, 
"UTF-8");
 
   53            return stripos($a_haystack, $a_needle, $a_offset);
 
   78    public static function strLen($a_string)
 
   80        if (function_exists(
"mb_strlen")) {
 
   81            return mb_strlen($a_string, 
"UTF-8");
 
   83            return strlen($a_string);
 
   89        if (function_exists(
"mb_strtolower")) {
 
   90            return mb_strtolower($a_string, 
"UTF-8");
 
   92            return strtolower($a_string);
 
   98        $a_string = (string) $a_string;
 
   99        if (function_exists(
"mb_strtoupper")) {
 
  100            return mb_strtoupper($a_string, 
"UTF-8");
 
  102            return strtoupper($a_string);
 
  114        if (isset(
$DIC[
"ilCollator"])) {
 
  115            $ilCollator = 
$DIC[
"ilCollator"];
 
  118        if (is_object($ilCollator)) {
 
  138    public static function shortenText($a_string, $a_start_pos, $a_num_bytes, $a_encoding = 
'UTF-8')
 
  140        if (function_exists(
"mb_strcut")) {
 
  141            return mb_strcut($a_string, $a_start_pos, $a_num_bytes, $a_encoding);
 
  143        return substr($a_string, $a_start_pos, $a_num_bytes);
 
  151        if (function_exists(
"mb_detect_encoding")) {
 
  152            if (mb_detect_encoding($a_str, 
"UTF-8", 
true) == 
"UTF-8") {
 
  160            $len = strlen($a_str);
 
  161            for (
$i = 0; 
$i < $len; 
$i++) {
 
  162                $c = ord($a_str[
$i]);
 
  166                    } elseif (
$c >= 252) {
 
  168                    } elseif (
$c >= 248) {
 
  170                    } elseif (
$c >= 240) {
 
  172                    } elseif (
$c >= 224) {
 
  174                    } elseif (
$c >= 192) {
 
  179                    if ((
$i + $bits) > $len) {
 
  184                        $b = ord($a_str[
$i]);
 
  185                        if ($b < 128 || $b > 191) {
 
  205    public static function strPosAll($a_haystack, $a_needle)
 
  207        $positions = array();
 
  209        while (is_int($pos = strpos($a_haystack, $a_needle, $cpos))) {
 
  221        if (is_int(strpos($a_str, $a_old))) {
 
  222            $a_str = substr_replace($a_str, $a_new, strpos($a_str, $a_old), strlen($a_old));
 
  234        return strtolower(preg_replace(
 
  235            array(
'#(?<=(?:[A-Z]))([A-Z]+)([A-Z][A-z])#', 
'#(?<=(?:[a-z0-9]))([A-Z])#'),
 
  236            array(
'\1_\2', 
'_\1'),
 
  252        for (
$i = 0; 
$i < strlen($a_str); 
$i++) {
 
  253            $bytes[] = ord($a_str[
$i]);
 
  266        include_once(
"./include/Unicode/UtfNormal.php");
 
An exception for terminatinating execution or to throw for unit testing.
static toNFC($string)
Convert a UTF-8 string to normal form C, canonical composition.
Multi byte sensitive string functions.
static strPos($a_haystack, $a_needle, $a_offset=null)
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 strPosAll($a_haystack, $a_needle)
Get all positions of a string.
static normalizeUtf8String($a_str)
Normalize UTF8 string.
static getBytesForString($a_str)
Return string as byte array Note: Use this for debugging purposes only.
static shortenText($a_string, $a_start_pos, $a_num_bytes, $a_encoding='UTF-8')
Shorten text to the given number of bytes.
static strIPos($a_haystack, $a_needle, $a_offset=null)
static strToLower($a_string)
static subStr($a_str, $a_start, $a_length=null)
static isUtf8($a_str)
Check whether string is utf-8.
static replaceFirsOccurence($a_old, $a_new, $a_str)
Replaces the first occurence of $a_old in $a_str with $a_new.
static strCmp($a, $b)
Compare two strings.
static strToUpper($a_string)