Advertisement
kernel_memory_dump

Untitled

Mar 21st, 2015
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <string>
  4. #include <sstream>
  5.  
  6. using namespace std;
  7.  
  8. std::vector<std::string> &split(const std::string &s, char delim, std::vector<std::string> &elems) {
  9.     std::stringstream ss(s);
  10.     std::string item;
  11.     while (std::getline(ss, item, delim)) {
  12.         elems.push_back(item);
  13.     }
  14.     return elems;
  15. }
  16.  
  17.  
  18. std::vector<std::string> split(const std::string &s, char delim) {
  19.     std::vector<std::string> elems;
  20.     split(s, delim, elems);
  21.     return elems;
  22. }
  23.  
  24. int main()
  25. {
  26.     cout << "Hello world!" << endl;
  27.     std::vector<std::string> x = split("Nikola;Nikolic;1234567891011", ';');
  28.  
  29.     for(int i = 0; i < x.size(); i++){
  30.         cout << x[i] << endl;
  31.     }
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement