@@ 1552-1561 (lines=10) @@ | ||
1549 | * |
|
1550 | * @return static <p>Object with the resulting $str after the replacements.</p> |
|
1551 | */ |
|
1552 | public function replace(string $search, string $replacement, bool $caseSensitive = true): self |
|
1553 | { |
|
1554 | if ($caseSensitive) { |
|
1555 | $return = UTF8::str_replace($search, $replacement, $this->str); |
|
1556 | } else { |
|
1557 | $return = UTF8::str_ireplace($search, $replacement, $this->str); |
|
1558 | } |
|
1559 | ||
1560 | return static::create($return, $this->encoding); |
|
1561 | } |
|
1562 | ||
1563 | /** |
|
1564 | * Replaces all occurrences of $search in $str by $replacement. |
|
@@ 1572-1581 (lines=10) @@ | ||
1569 | * |
|
1570 | * @return static <p>Object with the resulting $str after the replacements.</p> |
|
1571 | */ |
|
1572 | public function replaceAll(array $search, $replacement, bool $caseSensitive = true): self |
|
1573 | { |
|
1574 | if ($caseSensitive) { |
|
1575 | $return = UTF8::str_replace($search, $replacement, $this->str); |
|
1576 | } else { |
|
1577 | $return = UTF8::str_ireplace($search, $replacement, $this->str); |
|
1578 | } |
|
1579 | ||
1580 | return static::create($return, $this->encoding); |
|
1581 | } |
|
1582 | ||
1583 | /** |
|
1584 | * Replaces first occurrences of $search from the beginning of string with $replacement. |