From f3166702d7dd30312b5a401f52941aad43ac51c3 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sat, 30 Jan 2021 13:01:01 -0500 Subject: Added standing/walking animations --- src/util.h | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/util.h (limited to 'src/util.h') diff --git a/src/util.h b/src/util.h new file mode 100644 index 0000000..8cdad3d --- /dev/null +++ b/src/util.h @@ -0,0 +1,39 @@ +#ifndef UTIL_H_4AC35025 +#define UTIL_H_4AC35025 + +#include +#include + +template +void splitStr( + std::string input, + std::string delimiter, + OutputIterator out) { + while (!input.empty()) { + int divider = input.find(delimiter); + if (divider == std::string::npos) { + *out = input; + out++; + + input = ""; + } else { + *out = input.substr(0, divider); + out++; + + input = input.substr(divider+delimiter.length()); + } + } +} + +template +Container splitStr( + std::string input, + std::string delimiter) { + Container result; + + splitStr(input, delimiter, std::back_inserter(result)); + + return result; +} + +#endif /* end of include guard: UTIL_H_4AC35025 */ -- cgit 1.4.1