|
@@ 3668-3679 (lines=12) @@
|
| 3665 |
|
* |
| 3666 |
|
* @return string The string with unwanted characters stripped from the right |
| 3667 |
|
*/ |
| 3668 |
|
public static function rtrim($string = '', $chars = INF) |
| 3669 |
|
{ |
| 3670 |
|
$string = (string)$string; |
| 3671 |
|
|
| 3672 |
|
if (!isset($string[0])) { |
| 3673 |
|
return ''; |
| 3674 |
|
} |
| 3675 |
|
|
| 3676 |
|
$chars = INF === $chars ? '\s' : self::rxClass($chars); |
| 3677 |
|
|
| 3678 |
|
return preg_replace("/{$chars}+$/u", '', $string); |
| 3679 |
|
} |
| 3680 |
|
|
| 3681 |
|
/** |
| 3682 |
|
* Strip whitespace or other characters from beginning of a UTF-8 string. |
|
@@ 3691-3702 (lines=12) @@
|
| 3688 |
|
* |
| 3689 |
|
* @return string The string with unwanted characters stripped from the left |
| 3690 |
|
*/ |
| 3691 |
|
public static function ltrim($string = '', $chars = INF) |
| 3692 |
|
{ |
| 3693 |
|
$string = (string)$string; |
| 3694 |
|
|
| 3695 |
|
if (!isset($string[0])) { |
| 3696 |
|
return ''; |
| 3697 |
|
} |
| 3698 |
|
|
| 3699 |
|
$chars = INF === $chars ? '\s' : self::rxClass($chars); |
| 3700 |
|
|
| 3701 |
|
return preg_replace("/^{$chars}+/u", '', $string); |
| 3702 |
|
} |
| 3703 |
|
|
| 3704 |
|
/** |
| 3705 |
|
* Replace text within a portion of a string. |