ModelLoader.cpp 603 B

1234567891011121314151617181920212223242526272829303132
  1. #include "Header.h"
  2. #include "ModelLoader.h"
  3. string replace(string str, string toReplace, string replacement)
  4. {
  5. size_t index = 0;
  6. while (true)
  7. {
  8. index = str.find(toReplace, index);
  9. if (index == std::string::npos)
  10. break;
  11. str.replace(index, toReplace.length(), replacement);
  12. ++index;
  13. }
  14. return str;
  15. }
  16. vector<string> split(string str, string sep)
  17. {
  18. std::vector<std::string> ret;
  19. size_t index;
  20. while (true)
  21. {
  22. index = str.find(sep);
  23. if (index == std::string::npos)
  24. break;
  25. ret.push_back(str.substr(0, index));
  26. str = str.substr(index + 1);
  27. }
  28. ret.push_back(str);
  29. return ret;
  30. }