|
@@ 3735-3746 (lines=12) @@
|
| 3732 |
|
* |
| 3733 |
|
* @return string The string with unwanted characters stripped from the right |
| 3734 |
|
*/ |
| 3735 |
|
public static function rtrim($str = '', $chars = INF) |
| 3736 |
|
{ |
| 3737 |
|
$str = (string)$str; |
| 3738 |
|
|
| 3739 |
|
if (!isset($str[0])) { |
| 3740 |
|
return ''; |
| 3741 |
|
} |
| 3742 |
|
|
| 3743 |
|
$chars = INF === $chars ? '\s' : self::rxClass($chars); |
| 3744 |
|
|
| 3745 |
|
return preg_replace("/{$chars}+$/u", '', $str); |
| 3746 |
|
} |
| 3747 |
|
|
| 3748 |
|
/** |
| 3749 |
|
* Strip whitespace or other characters from beginning of a UTF-8 string. |
|
@@ 3758-3769 (lines=12) @@
|
| 3755 |
|
* |
| 3756 |
|
* @return string The string with unwanted characters stripped from the left |
| 3757 |
|
*/ |
| 3758 |
|
public static function ltrim($str = '', $chars = INF) |
| 3759 |
|
{ |
| 3760 |
|
$str = (string)$str; |
| 3761 |
|
|
| 3762 |
|
if (!isset($str[0])) { |
| 3763 |
|
return ''; |
| 3764 |
|
} |
| 3765 |
|
|
| 3766 |
|
$chars = INF === $chars ? '\s' : self::rxClass($chars); |
| 3767 |
|
|
| 3768 |
|
return preg_replace("/^{$chars}+/u", '', $str); |
| 3769 |
|
} |
| 3770 |
|
|
| 3771 |
|
/** |
| 3772 |
|
* Replace text within a portion of a string. |