That’s the method for an array. You can’t do that in a string (and it turns out, making a vector of substitution pairs won’t help):
Related topics
| Topic | Replies | Views | Activity | |
|---|---|---|---|---|
| Replace two substrings in a string with the same `replace` call? | 2 | 355 | October 20, 2021 | |
| Perform multiple replacements on a string in a single pass | 19 | 10001 | January 18, 2022 | |
| Replacing multiple strings errors | 11 | 4636 | March 13, 2019 | |
| Why isn't string replace variadic? | 1 | 283 | May 28, 2021 | |
| Replace behaving strange? | 6 | 855 | May 31, 2019 |