| @@ 1600-1611 (lines=12) @@ | ||
| 1597 | * |
|
| 1598 | * @return static |
|
| 1599 | */ |
|
| 1600 | public function substringOf($needle, $beforeNeedle = false) |
|
| 1601 | { |
|
| 1602 | if ('' === $needle) { |
|
| 1603 | return static::create(''); |
|
| 1604 | } |
|
| 1605 | ||
| 1606 | if (false === $part = UTF8::strstr($this->str, $needle, $beforeNeedle, $this->encoding)) { |
|
| 1607 | return static::create(''); |
|
| 1608 | } |
|
| 1609 | ||
| 1610 | return static::create($part); |
|
| 1611 | } |
|
| 1612 | ||
| 1613 | /** |
|
| 1614 | * Gets the substring after (or before via "$beforeNeedle") the first occurrence of the "$needle". |
|
| @@ 1622-1633 (lines=12) @@ | ||
| 1619 | * |
|
| 1620 | * @return static |
|
| 1621 | */ |
|
| 1622 | public function substringOfIgnoreCase($needle, $beforeNeedle = false) |
|
| 1623 | { |
|
| 1624 | if ('' === $needle) { |
|
| 1625 | return static::create(''); |
|
| 1626 | } |
|
| 1627 | ||
| 1628 | if (false === $part = UTF8::stristr($this->str, $needle, $beforeNeedle, $this->encoding)) { |
|
| 1629 | return static::create(''); |
|
| 1630 | } |
|
| 1631 | ||
| 1632 | return static::create($part); |
|
| 1633 | } |
|
| 1634 | ||
| 1635 | /** |
|
| 1636 | * Gets the substring after (or before via "$beforeNeedle") the last occurrence of the "$needle". |
|
| @@ 1644-1655 (lines=12) @@ | ||
| 1641 | * |
|
| 1642 | * @return static |
|
| 1643 | */ |
|
| 1644 | public function lastSubstringOf($needle, $beforeNeedle = false) |
|
| 1645 | { |
|
| 1646 | if ('' === $needle) { |
|
| 1647 | return static::create(''); |
|
| 1648 | } |
|
| 1649 | ||
| 1650 | if (false === $part = UTF8::strrchr($this->str, $needle, $beforeNeedle, $this->encoding)) { |
|
| 1651 | return static::create(''); |
|
| 1652 | } |
|
| 1653 | ||
| 1654 | return static::create($part); |
|
| 1655 | } |
|
| 1656 | ||
| 1657 | /** |
|
| 1658 | * Gets the substring after (or before via "$beforeNeedle") the last occurrence of the "$needle". |
|
| @@ 1666-1677 (lines=12) @@ | ||
| 1663 | * |
|
| 1664 | * @return static |
|
| 1665 | */ |
|
| 1666 | public function lastSubstringOfIgnoreCase($needle, $beforeNeedle = false) |
|
| 1667 | { |
|
| 1668 | if ('' === $needle) { |
|
| 1669 | return static::create(''); |
|
| 1670 | } |
|
| 1671 | ||
| 1672 | if (false === $part = UTF8::strrichr($this->str, $needle, $beforeNeedle, $this->encoding)) { |
|
| 1673 | return static::create(''); |
|
| 1674 | } |
|
| 1675 | ||
| 1676 | return static::create($part); |
|
| 1677 | } |
|
| 1678 | ||
| 1679 | /** |
|
| 1680 | * Returns a reversed string. A multibyte version of strrev(). |
|