Advertisement
Guest User

Untitled

a guest
Jan 24th, 2020
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <string>
  4.  
  5. void actuallyRemoveOccurrencesThanksYouVeryMuch(std::string& str, char charToRemove) {
  6. str.erase(std::remove(str.begin(), str.end(), charToRemove), str.end());
  7. }
  8.  
  9. int main() {
  10. std::string s = "#Hello #World!!";
  11. actuallyRemoveOccurrencesThanksYouVeryMuch(s, '#');
  12. std::cout << s;
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement