| @@ 3891-3902 (lines=12) @@ | ||
| 3888 | * |
|
| 3889 | * @return string The string with unwanted characters stripped from the left |
|
| 3890 | */ |
|
| 3891 | public static function ltrim($str = '', $chars = INF) |
|
| 3892 | { |
|
| 3893 | $str = (string)$str; |
|
| 3894 | ||
| 3895 | if (!isset($str[0])) { |
|
| 3896 | return ''; |
|
| 3897 | } |
|
| 3898 | ||
| 3899 | $chars = INF === $chars ? '\s' : self::rxClass($chars); |
|
| 3900 | ||
| 3901 | return preg_replace("/^{$chars}+/u", '', $str); |
|
| 3902 | } |
|
| 3903 | ||
| 3904 | /** |
|
| 3905 | * Returns the UTF-8 character with the maximum code point in the given data. |
|
| @@ 4359-4370 (lines=12) @@ | ||
| 4356 | * |
|
| 4357 | * @return string The string with unwanted characters stripped from the right |
|
| 4358 | */ |
|
| 4359 | public static function rtrim($str = '', $chars = INF) |
|
| 4360 | { |
|
| 4361 | $str = (string)$str; |
|
| 4362 | ||
| 4363 | if (!isset($str[0])) { |
|
| 4364 | return ''; |
|
| 4365 | } |
|
| 4366 | ||
| 4367 | $chars = INF === $chars ? '\s' : self::rxClass($chars); |
|
| 4368 | ||
| 4369 | return preg_replace("/{$chars}+$/u", '', $str); |
|
| 4370 | } |
|
| 4371 | ||
| 4372 | /** |
|
| 4373 | * rxClass |
|