|
@@ 863-876 (lines=14) @@
|
| 860 |
|
* |
| 861 |
|
* @return static <p>Object with the first character of $str being upper case.</p> |
| 862 |
|
*/ |
| 863 |
|
public function upperCaseFirst(): self |
| 864 |
|
{ |
| 865 |
|
$first = UTF8::substr($this->str, 0, 1, $this->encoding); |
| 866 |
|
$rest = UTF8::substr( |
| 867 |
|
$this->str, |
| 868 |
|
1, |
| 869 |
|
$this->length() - 1, |
| 870 |
|
$this->encoding |
| 871 |
|
); |
| 872 |
|
|
| 873 |
|
$str = UTF8::strtoupper($first, $this->encoding) . $rest; |
| 874 |
|
|
| 875 |
|
return static::create($str, $this->encoding); |
| 876 |
|
} |
| 877 |
|
|
| 878 |
|
/** |
| 879 |
|
* Returns the index of the last occurrence of $needle in the string, |
|
@@ 2617-2625 (lines=9) @@
|
| 2614 |
|
* |
| 2615 |
|
* @return static <p>Object with the first character of $str being lower case.</p> |
| 2616 |
|
*/ |
| 2617 |
|
public function lowerCaseFirst(): self |
| 2618 |
|
{ |
| 2619 |
|
$first = UTF8::substr($this->str, 0, 1, $this->encoding); |
| 2620 |
|
$rest = UTF8::substr($this->str, 1, $this->length() - 1, $this->encoding); |
| 2621 |
|
|
| 2622 |
|
$str = UTF8::strtolower($first, $this->encoding) . $rest; |
| 2623 |
|
|
| 2624 |
|
return static::create($str, $this->encoding); |
| 2625 |
|
} |
| 2626 |
|
|
| 2627 |
|
/** |
| 2628 |
|
* Shorten the string after $length, but also after the next word. |