|
@@ 1522-1531 (lines=10) @@
|
| 1519 |
|
* |
| 1520 |
|
* @return static <p>Object with the resulting $str after the replacements.</p> |
| 1521 |
|
*/ |
| 1522 |
|
public function replace(string $search, string $replacement, bool $caseSensitive = true): self |
| 1523 |
|
{ |
| 1524 |
|
if ($caseSensitive) { |
| 1525 |
|
$return = UTF8::str_replace($search, $replacement, $this->str); |
| 1526 |
|
} else { |
| 1527 |
|
$return = UTF8::str_ireplace($search, $replacement, $this->str); |
| 1528 |
|
} |
| 1529 |
|
|
| 1530 |
|
return static::create($return); |
| 1531 |
|
} |
| 1532 |
|
|
| 1533 |
|
/** |
| 1534 |
|
* Replaces all occurrences of $search in $str by $replacement. |
|
@@ 1542-1551 (lines=10) @@
|
| 1539 |
|
* |
| 1540 |
|
* @return static <p>Object with the resulting $str after the replacements.</p> |
| 1541 |
|
*/ |
| 1542 |
|
public function replaceAll(array $search, $replacement, bool $caseSensitive = true): self |
| 1543 |
|
{ |
| 1544 |
|
if ($caseSensitive) { |
| 1545 |
|
$return = UTF8::str_replace($search, $replacement, $this->str); |
| 1546 |
|
} else { |
| 1547 |
|
$return = UTF8::str_ireplace($search, $replacement, $this->str); |
| 1548 |
|
} |
| 1549 |
|
|
| 1550 |
|
return static::create($return); |
| 1551 |
|
} |
| 1552 |
|
|
| 1553 |
|
/** |
| 1554 |
|
* Replaces all occurrences of $search from the beginning of string with $replacement. |