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