fork download
  1. #include <iostream>
  2. #include <sstream>
  3. #include <string>
  4.  
  5. int main()
  6. {
  7. char const* const tag = "tag5";
  8. char const* const record = "tag1{0}|tag2{0}|tag3{0}|tag4{0}|tag5{tag51{0};tag52{0};tag53{0};tag54{0};tag55{tag551{0}:tag552{0}:tag553{0}:tag554{0}:tag555{0}}}";
  9. char const delim = '|';
  10.  
  11. std::stringstream ss(record);
  12. for (std::string token; std::getline(ss, token, delim); ) {
  13. std::cout << token << '\n';
  14. }
  15. }
  16.  
Success #stdin #stdout 0s 3428KB
stdin
Standard input is empty
stdout
tag1{0}
tag2{0}
tag3{0}
tag4{0}
tag5{tag51{0};tag52{0};tag53{0};tag54{0};tag55{tag551{0}:tag552{0}:tag553{0}:tag554{0}:tag555{0}}}