|
@@ 3554-3565 (lines=12) @@
|
| 3551 |
|
* |
| 3552 |
|
* @return string The string with unwanted characters stripped from the right |
| 3553 |
|
*/ |
| 3554 |
|
public static function rtrim($string = '', $chars = INF) |
| 3555 |
|
{ |
| 3556 |
|
$string = (string)$string; |
| 3557 |
|
|
| 3558 |
|
if (!isset($string[0])) { |
| 3559 |
|
return ''; |
| 3560 |
|
} |
| 3561 |
|
|
| 3562 |
|
$chars = INF === $chars ? '\s' : self::rxClass($chars); |
| 3563 |
|
|
| 3564 |
|
return preg_replace("/{$chars}+$/u", '', $string); |
| 3565 |
|
} |
| 3566 |
|
|
| 3567 |
|
/** |
| 3568 |
|
* strip whitespace or other characters from beginning of a UTF-8 string |
|
@@ 3577-3588 (lines=12) @@
|
| 3574 |
|
* |
| 3575 |
|
* @return string The string with unwanted characters stripped from the left |
| 3576 |
|
*/ |
| 3577 |
|
public static function ltrim($string = '', $chars = INF) |
| 3578 |
|
{ |
| 3579 |
|
$string = (string)$string; |
| 3580 |
|
|
| 3581 |
|
if (!isset($string[0])) { |
| 3582 |
|
return ''; |
| 3583 |
|
} |
| 3584 |
|
|
| 3585 |
|
$chars = INF === $chars ? '\s' : self::rxClass($chars); |
| 3586 |
|
|
| 3587 |
|
return preg_replace("/^{$chars}+/u", '', $string); |
| 3588 |
|
} |
| 3589 |
|
|
| 3590 |
|
/** |
| 3591 |
|
* Replace text within a portion of a string |