|
@@ 5704-5724 (lines=21) @@
|
| 5701 |
|
* |
| 5702 |
|
* @return string str with all alphabetic characters converted to lowercase. |
| 5703 |
|
*/ |
| 5704 |
|
public static function strtolower($str, $encoding = 'UTF-8', $cleanUtf8 = false) |
| 5705 |
|
{ |
| 5706 |
|
// init |
| 5707 |
|
$str = (string)$str; |
| 5708 |
|
|
| 5709 |
|
if (!isset($str[0])) { |
| 5710 |
|
return ''; |
| 5711 |
|
} |
| 5712 |
|
|
| 5713 |
|
if ($cleanUtf8 === true) { |
| 5714 |
|
// "\mb_strpos" and "\iconv_strpos" returns wrong position, |
| 5715 |
|
// if invalid characters are found in $haystack before $needle |
| 5716 |
|
$str = self::clean($str); |
| 5717 |
|
} |
| 5718 |
|
|
| 5719 |
|
if ($encoding !== 'UTF-8') { |
| 5720 |
|
$encoding = self::normalize_encoding($encoding); |
| 5721 |
|
} |
| 5722 |
|
|
| 5723 |
|
return \mb_strtolower($str, $encoding); |
| 5724 |
|
} |
| 5725 |
|
|
| 5726 |
|
/** |
| 5727 |
|
* Generic case sensitive transformation for collation matching. |
|
@@ 5750-5769 (lines=20) @@
|
| 5747 |
|
* |
| 5748 |
|
* @return string str with all alphabetic characters converted to uppercase. |
| 5749 |
|
*/ |
| 5750 |
|
public static function strtoupper($str, $encoding = 'UTF-8', $cleanUtf8 = false) |
| 5751 |
|
{ |
| 5752 |
|
$str = (string)$str; |
| 5753 |
|
|
| 5754 |
|
if (!isset($str[0])) { |
| 5755 |
|
return ''; |
| 5756 |
|
} |
| 5757 |
|
|
| 5758 |
|
if ($cleanUtf8 === true) { |
| 5759 |
|
// "\mb_strpos" and "\iconv_strpos" returns wrong position, |
| 5760 |
|
// if invalid characters are found in $haystack before $needle |
| 5761 |
|
$str = self::clean($str); |
| 5762 |
|
} |
| 5763 |
|
|
| 5764 |
|
if ($encoding !== 'UTF-8') { |
| 5765 |
|
$encoding = self::normalize_encoding($encoding); |
| 5766 |
|
} |
| 5767 |
|
|
| 5768 |
|
return \mb_strtoupper($str, $encoding); |
| 5769 |
|
} |
| 5770 |
|
|
| 5771 |
|
/** |
| 5772 |
|
* Translate characters or replace sub-strings. |