Moved split to own helper-file

OLD_dev
Ruakij 3 years ago
parent 6de2063288
commit 8a62d2899b

@ -7,18 +7,7 @@
#include <sstream> #include <sstream>
#include <locale> #include <locale>
#include <iomanip> #include <iomanip>
#include "../helper/split.hpp"
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;
}
uint64_t convertStringToTimestampMicros(std::string textTimestamp){ uint64_t convertStringToTimestampMicros(std::string textTimestamp){
uint64_t timestamp; uint64_t timestamp;
@ -63,7 +52,7 @@ void textPacketHandler(std::vector<std::string> textPacket){
std::string textTimestamp = headerData[0]; std::string textTimestamp = headerData[0];
uint64_t timestamp = convertStringToTimestampMicros(textTimestamp); uint64_t timestamp = convertStringToTimestampMicros(textTimestamp);
} }
#endif /* EE781A91_6D07_47AC_B3C4_F99E29F3731F */ #endif /* EE781A91_6D07_47AC_B3C4_F99E29F3731F */

@ -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 */
Loading…
Cancel
Save