|
@@ 3544-3555 (lines=12) @@
|
| 3541 |
|
* |
| 3542 |
|
* @return string The string with unwanted characters stripped from the right |
| 3543 |
|
*/ |
| 3544 |
|
public static function rtrim($string = '', $chars = INF) |
| 3545 |
|
{ |
| 3546 |
|
$string = (string)$string; |
| 3547 |
|
|
| 3548 |
|
if (!isset($string[0])) { |
| 3549 |
|
return ''; |
| 3550 |
|
} |
| 3551 |
|
|
| 3552 |
|
$chars = INF === $chars ? '\s' : self::rxClass($chars); |
| 3553 |
|
|
| 3554 |
|
return preg_replace("/{$chars}+$/u", '', $string); |
| 3555 |
|
} |
| 3556 |
|
|
| 3557 |
|
/** |
| 3558 |
|
* strip whitespace or other characters from beginning of a UTF-8 string |
|
@@ 3567-3578 (lines=12) @@
|
| 3564 |
|
* |
| 3565 |
|
* @return string The string with unwanted characters stripped from the left |
| 3566 |
|
*/ |
| 3567 |
|
public static function ltrim($string = '', $chars = INF) |
| 3568 |
|
{ |
| 3569 |
|
$string = (string)$string; |
| 3570 |
|
|
| 3571 |
|
if (!isset($string[0])) { |
| 3572 |
|
return ''; |
| 3573 |
|
} |
| 3574 |
|
|
| 3575 |
|
$chars = INF === $chars ? '\s' : self::rxClass($chars); |
| 3576 |
|
|
| 3577 |
|
return preg_replace("/^{$chars}+/u", '', $string); |
| 3578 |
|
} |
| 3579 |
|
|
| 3580 |
|
/** |
| 3581 |
|
* Replace text within a portion of a string |