Write a function that takes three strings s, oldVal and newVal. Using iterators, and the insert and erase functions replace all instances of oldVal that appear in s by newVal. Test your function by using it to replace common abbreviations, such as "tho" by "though" and "thru" by through". |
Write a function that takes three strings s, oldVal and newVal |
void foo(std::string& s, const std::string& oldVal, const std::string& newVal)
Using iterators, and the insert and erase functions replace all instances of oldVal that appear in s by newVal.