wheelsmanx

regex edit for ++

Feb 20th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. string testString = "22.5 + 5.5i";
  2. vector<double> test;
  3. smatch matches;
  4. regex regexString("((\\d*)[.](\\d*))");
  5. size_t sz;
  6.  
  7.  
  8. while (regex_search(testString, matches, regexString)){
  9. test.push_back(stod(matches[0], &sz));
  10. matches.empty();
  11. testString = matches.suffix().str();
  12. }
  13. for (auto ele : test) {
  14. cout << ele << endl;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment