|
@@ 5376-5396 (lines=21) @@
|
| 5373 |
|
* |
| 5374 |
|
* @return string str with all alphabetic characters converted to lowercase. |
| 5375 |
|
*/ |
| 5376 |
|
public static function strtolower($str, $encoding = 'UTF-8', $cleanUtf8 = false) |
| 5377 |
|
{ |
| 5378 |
|
// init |
| 5379 |
|
$str = (string)$str; |
| 5380 |
|
|
| 5381 |
|
if (!isset($str[0])) { |
| 5382 |
|
return ''; |
| 5383 |
|
} |
| 5384 |
|
|
| 5385 |
|
if ($cleanUtf8 === true) { |
| 5386 |
|
// "\mb_strpos" and "\iconv_strpos" returns wrong position, |
| 5387 |
|
// if invalid characters are found in $haystack before $needle |
| 5388 |
|
$str = self::clean($str); |
| 5389 |
|
} |
| 5390 |
|
|
| 5391 |
|
if ($encoding !== 'UTF-8') { |
| 5392 |
|
$encoding = self::normalize_encoding($encoding); |
| 5393 |
|
} |
| 5394 |
|
|
| 5395 |
|
return \mb_strtolower($str, $encoding); |
| 5396 |
|
} |
| 5397 |
|
|
| 5398 |
|
/** |
| 5399 |
|
* Generic case sensitive transformation for collation matching. |
|
@@ 5422-5441 (lines=20) @@
|
| 5419 |
|
* |
| 5420 |
|
* @return string str with all alphabetic characters converted to uppercase. |
| 5421 |
|
*/ |
| 5422 |
|
public static function strtoupper($str, $encoding = 'UTF-8', $cleanUtf8 = false) |
| 5423 |
|
{ |
| 5424 |
|
$str = (string)$str; |
| 5425 |
|
|
| 5426 |
|
if (!isset($str[0])) { |
| 5427 |
|
return ''; |
| 5428 |
|
} |
| 5429 |
|
|
| 5430 |
|
if ($cleanUtf8 === true) { |
| 5431 |
|
// "\mb_strpos" and "\iconv_strpos" returns wrong position, |
| 5432 |
|
// if invalid characters are found in $haystack before $needle |
| 5433 |
|
$str = self::clean($str); |
| 5434 |
|
} |
| 5435 |
|
|
| 5436 |
|
if ($encoding !== 'UTF-8') { |
| 5437 |
|
$encoding = self::normalize_encoding($encoding); |
| 5438 |
|
} |
| 5439 |
|
|
| 5440 |
|
return \mb_strtoupper($str, $encoding); |
| 5441 |
|
} |
| 5442 |
|
|
| 5443 |
|
/** |
| 5444 |
|
* Translate characters or replace sub-strings. |