|
@@ 5500-5520 (lines=21) @@
|
| 5497 |
|
* |
| 5498 |
|
* @return string str with all alphabetic characters converted to lowercase. |
| 5499 |
|
*/ |
| 5500 |
|
public static function strtolower($str, $encoding = 'UTF-8', $cleanUtf8 = false) |
| 5501 |
|
{ |
| 5502 |
|
// init |
| 5503 |
|
$str = (string)$str; |
| 5504 |
|
|
| 5505 |
|
if (!isset($str[0])) { |
| 5506 |
|
return ''; |
| 5507 |
|
} |
| 5508 |
|
|
| 5509 |
|
if ($cleanUtf8 === true) { |
| 5510 |
|
// "\mb_strpos" and "\iconv_strpos" returns wrong position, |
| 5511 |
|
// if invalid characters are found in $haystack before $needle |
| 5512 |
|
$str = self::clean($str); |
| 5513 |
|
} |
| 5514 |
|
|
| 5515 |
|
if ($encoding !== 'UTF-8') { |
| 5516 |
|
$encoding = self::normalize_encoding($encoding); |
| 5517 |
|
} |
| 5518 |
|
|
| 5519 |
|
return \mb_strtolower($str, $encoding); |
| 5520 |
|
} |
| 5521 |
|
|
| 5522 |
|
/** |
| 5523 |
|
* Generic case sensitive transformation for collation matching. |
|
@@ 5546-5565 (lines=20) @@
|
| 5543 |
|
* |
| 5544 |
|
* @return string str with all alphabetic characters converted to uppercase. |
| 5545 |
|
*/ |
| 5546 |
|
public static function strtoupper($str, $encoding = 'UTF-8', $cleanUtf8 = false) |
| 5547 |
|
{ |
| 5548 |
|
$str = (string)$str; |
| 5549 |
|
|
| 5550 |
|
if (!isset($str[0])) { |
| 5551 |
|
return ''; |
| 5552 |
|
} |
| 5553 |
|
|
| 5554 |
|
if ($cleanUtf8 === true) { |
| 5555 |
|
// "\mb_strpos" and "\iconv_strpos" returns wrong position, |
| 5556 |
|
// if invalid characters are found in $haystack before $needle |
| 5557 |
|
$str = self::clean($str); |
| 5558 |
|
} |
| 5559 |
|
|
| 5560 |
|
if ($encoding !== 'UTF-8') { |
| 5561 |
|
$encoding = self::normalize_encoding($encoding); |
| 5562 |
|
} |
| 5563 |
|
|
| 5564 |
|
return \mb_strtoupper($str, $encoding); |
| 5565 |
|
} |
| 5566 |
|
|
| 5567 |
|
/** |
| 5568 |
|
* Translate characters or replace sub-strings. |