24     public static function subStr(
string $a_str, 
int $a_start, ?
int $a_length = null): string
    26         if (function_exists(
"mb_substr")) {
    29             if ($a_length === null) {
    30                 $a_length = mb_strlen($a_str, 
"UTF-8");
    33             return mb_substr($a_str, $a_start, $a_length, 
"UTF-8");
    35             return substr($a_str, $a_start, $a_length);
    42     public static function strPos(
string $a_haystack, 
string $a_needle, 
int $a_offset = 0)
    44         if (function_exists(
"mb_strpos")) {
    45             return mb_strpos($a_haystack, $a_needle, $a_offset, 
"UTF-8");
    47             return strpos($a_haystack, $a_needle, $a_offset);
    54     public static function strIPos(
string $a_haystack, 
string $a_needle, 
int $a_offset = 0)
    56         if (function_exists(
"mb_stripos")) {
    57             return mb_stripos($a_haystack, $a_needle, $a_offset, 
"UTF-8");
    59             return stripos($a_haystack, $a_needle, $a_offset);
    63     public static function strLen(
string $a_string): 
int    65         if (function_exists(
"mb_strlen")) {
    66             return mb_strlen($a_string, 
"UTF-8");
    68             return strlen($a_string);
    72     public static function strToLower(
string $a_string): string
    74         if (function_exists(
"mb_strtolower")) {
    75             return mb_strtolower($a_string, 
"UTF-8");
    77             return strtolower($a_string);
    81     public static function strToUpper(
string $a_string): string
    83         if (function_exists(
"mb_strtoupper")) {
    84             return mb_strtoupper($a_string, 
"UTF-8");
    86             return strtoupper($a_string);
   106         string $a_encoding = 
'UTF-8'   108         if (function_exists(
"mb_strcut")) {
   109             return mb_strcut($a_string, $a_start_pos, $a_num_bytes, $a_encoding);
   111         return substr($a_string, $a_start_pos, $a_num_bytes);
   117     public static function isUtf8(
string $a_str): bool
   119         if (function_exists(
"mb_detect_encoding")) {
   120             if (mb_detect_encoding($a_str, 
"UTF-8", 
true) === 
"UTF-8") {
   128             $len = strlen($a_str);
   129             for ($i = 0; $i < $len; $i++) {
   130                 $c = ord($a_str[$i]);
   134                     } elseif (
$c >= 252) {
   136                     } elseif (
$c >= 248) {
   138                     } elseif (
$c >= 240) {
   140                     } elseif (
$c >= 224) {
   142                     } elseif (
$c >= 192) {
   147                     if (($i + $bits) > $len) {
   152                         $b = ord($a_str[$i]);
   153                         if ($b < 128 || $b > 191) {
   175                 [
'#(?<=(?:[A-Z]))([A-Z]+)([A-Z][A-z])#', 
'#(?<=(?:[a-z0-9]))([A-Z])#'],
   188         bool $a_dots = 
false,
   189         bool $a_next_blank = 
false,
   190         bool $a_keep_extension = 
false   212             if ($a_keep_extension) {
   213                 $p = strrpos($a_str, 
'.');    
   215             if ($p === 
false || $p == 0 || strlen($a_str) - $p > $a_len) {
   218                     $a_str .= 
"\xe2\x80\xa6"; 
   222                     $a_str = 
ilStr::subStr($a_str, 0, $len - (strlen($a_str) - $p + 1)) . 
"\xe2\x80\xa6" . substr(
   227                     $a_str = 
ilStr::subStr($a_str, 0, $len - (strlen($a_str) - $p + 1)) . substr($a_str, $p);
   241     public static function shortenWords(
string $a_str, 
int $a_len = 30, 
bool $a_dots = 
true): string
   243         $str_arr = explode(
" ", $a_str);
   245         for ($i = 0; $i < count($str_arr); $i++) {
   249                     $str_arr[$i] .= 
"...";
   254         return implode(
" ", $str_arr);
 static strIPos(string $a_haystack, string $a_needle, int $a_offset=0)
 
static convertUpperCamelCaseToUnderscoreCase(string $value)
Convert a value given in camel case conversion to underscore case conversion (e.g. 
 
static strPos(string $a_haystack, string $a_needle, int $a_offset=0)
 
static subStr(string $a_str, int $a_start, ?int $a_length=null)
 
static strLen(string $a_string)
 
static shortenText(string $a_string, int $a_start_pos, int $a_num_bytes, string $a_encoding='UTF-8')
Shorten text to the given number of bytes. 
 
static strToUpper(string $a_string)
 
static isUtf8(string $a_str)
Check whether string is utf-8. 
 
static strCmp(string $a, string $b)
 
static shortenTextExtended(string $a_str, int $a_len, bool $a_dots=false, bool $a_next_blank=false, bool $a_keep_extension=false)
 
static strToLower(string $a_string)
 
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples 
 
static shortenWords(string $a_str, int $a_len=30, bool $a_dots=true)
Ensure that the maximum word lenght within a text is not longer than $a_len.