Moved split to own helper-file

This commit is contained in:
Ruakij 2021-11-22 11:24:10 +01:00
parent 6de2063288
commit 8a62d2899b
2 changed files with 18 additions and 13 deletions

View File

@ -7,18 +7,7 @@
#include <sstream>
#include <locale>
#include <iomanip>
std::vector<std::string> split(const std::string& s, char delimiter)
{
std::vector<std::string> tokens;
std::string token;
std::istringstream tokenStream(s);
while (std::getline(tokenStream, token, delimiter))
{
tokens.push_back(token);
}
return tokens;
}
#include "../helper/split.hpp"
uint64_t convertStringToTimestampMicros(std::string textTimestamp){
uint64_t timestamp;

16
helper/split.hpp Normal file
View File

@ -0,0 +1,16 @@
#ifndef F7CFE6A7_34BF_4E04_94CF_DB8374980631
#define F7CFE6A7_34BF_4E04_94CF_DB8374980631
std::vector<std::string> split(const std::string& s, char delimiter)
{
std::vector<std::string> tokens;
std::string token;
std::istringstream tokenStream(s);
while (std::getline(tokenStream, token, delimiter))
{
tokens.push_back(token);
}
return tokens;
}
#endif /* F7CFE6A7_34BF_4E04_94CF_DB8374980631 */