diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-01-16 18:09:15 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-01-16 18:09:15 +0000 |
commit | 400410fcd436d5e4310bfa779f0309c5fae5b2c2 (patch) | |
tree | 89661918c487e63b6c71f2e9281b553928010606 /util.h | |
download | ilt-400410fcd436d5e4310bfa779f0309c5fae5b2c2.tar.bz2 ilt-400410fcd436d5e4310bfa779f0309c5fae5b2c2.tar.xz ilt-400410fcd436d5e4310bfa779f0309c5fae5b2c2.zip |
Initial commit
Stripped back and formatted from https://github.com/BennyQBD/ModernOpenGLTutorial/
Diffstat (limited to 'util.h')
-rw-r--r-- | util.h | 35 |
1 files changed, 35 insertions, 0 deletions
@@ -0,0 +1,35 @@ +#ifndef UTIL_H_INCLUDED +#define UTIL_H_INCLUDED + +#include "debugTimer.h" +#include <sstream> +#include <vector> + +namespace Util { + std::vector<std::string> + Split(const std::string & s, char delim) + { + std::vector<std::string> elems; + + const char * cstr = s.c_str(); + unsigned int strLength = s.length(); + unsigned int start = 0; + unsigned int end = 0; + + while (end <= strLength) { + while (end <= strLength) { + if (cstr[end] == delim) + break; + end++; + } + + elems.push_back(s.substr(start, end - start)); + start = end + 1; + end = start; + } + + return elems; + } +}; + +#endif // UTIL_H_INCLUDED |