|
@@ 5680-5700 (lines=21) @@
|
| 5677 |
|
* |
| 5678 |
|
* @return string str with all alphabetic characters converted to lowercase. |
| 5679 |
|
*/ |
| 5680 |
|
public static function strtolower($str, $encoding = 'UTF-8', $cleanUtf8 = false) |
| 5681 |
|
{ |
| 5682 |
|
// init |
| 5683 |
|
$str = (string)$str; |
| 5684 |
|
|
| 5685 |
|
if (!isset($str[0])) { |
| 5686 |
|
return ''; |
| 5687 |
|
} |
| 5688 |
|
|
| 5689 |
|
if ($cleanUtf8 === true) { |
| 5690 |
|
// "\mb_strpos" and "\iconv_strpos" returns wrong position, |
| 5691 |
|
// if invalid characters are found in $haystack before $needle |
| 5692 |
|
$str = self::clean($str); |
| 5693 |
|
} |
| 5694 |
|
|
| 5695 |
|
if ($encoding !== 'UTF-8') { |
| 5696 |
|
$encoding = self::normalize_encoding($encoding); |
| 5697 |
|
} |
| 5698 |
|
|
| 5699 |
|
return \mb_strtolower($str, $encoding); |
| 5700 |
|
} |
| 5701 |
|
|
| 5702 |
|
/** |
| 5703 |
|
* Generic case sensitive transformation for collation matching. |
|
@@ 5726-5745 (lines=20) @@
|
| 5723 |
|
* |
| 5724 |
|
* @return string str with all alphabetic characters converted to uppercase. |
| 5725 |
|
*/ |
| 5726 |
|
public static function strtoupper($str, $encoding = 'UTF-8', $cleanUtf8 = false) |
| 5727 |
|
{ |
| 5728 |
|
$str = (string)$str; |
| 5729 |
|
|
| 5730 |
|
if (!isset($str[0])) { |
| 5731 |
|
return ''; |
| 5732 |
|
} |
| 5733 |
|
|
| 5734 |
|
if ($cleanUtf8 === true) { |
| 5735 |
|
// "\mb_strpos" and "\iconv_strpos" returns wrong position, |
| 5736 |
|
// if invalid characters are found in $haystack before $needle |
| 5737 |
|
$str = self::clean($str); |
| 5738 |
|
} |
| 5739 |
|
|
| 5740 |
|
if ($encoding !== 'UTF-8') { |
| 5741 |
|
$encoding = self::normalize_encoding($encoding); |
| 5742 |
|
} |
| 5743 |
|
|
| 5744 |
|
return \mb_strtoupper($str, $encoding); |
| 5745 |
|
} |
| 5746 |
|
|
| 5747 |
|
/** |
| 5748 |
|
* Translate characters or replace sub-strings. |