Advertisement
STANAANDREY

ez tokenize func

Dec 17th, 2021 (edited)
1,152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.23 KB | None | 0 0
  1. vector<string> tokenize(string s, string sep) {
  2.     vector<string> r;
  3.     char *arr = &s[0];
  4.     for (char *tok = strtok(arr, sep.c_str()); tok; tok = strtok(NULL, sep.c_str())) {
  5.         r.push_back(tok);
  6.     }
  7.     return r;
  8. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement