Untitled


SUBMITTED BY: Guest

DATE: Feb. 18, 2021, 3:24 p.m.

FORMAT: Text only

SIZE: 270 Bytes

HITS: 298

  1. std::string delimiter = " ";
  2. size_t pos = 0;
  3. std::string token;
  4. while ((pos = s.find(delimiter)) != std::string::npos) {
  5. token = s.substr(0, pos);
  6. std::cout << token << std::endl;
  7. s.erase(0, pos + delimiter.length());
  8. }
  9. std::cout << s << std::endl;

comments powered by Disqus