fork download
  1. #include <iostream>
  2. #include <vector>
  3. #include <string.h>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. // Split string into a vector of tokens
  10. char str[] = "ngg://connect>100/username>example/";
  11. char *s = strtok(str, ">/");
  12. vector<string> tokens;
  13. while (s = strtok(NULL, ">/"))
  14. tokens.push_back(string(s));
  15.  
  16. // Display result
  17. for (unsigned int i = 0; i < tokens.size(); cout << tokens[i++] << endl);
  18. return 0;
  19. }
Success #stdin #stdout 0.02s 2816KB
stdin
Standard input is empty
stdout
connect
100
username
example