add split_string() utility
This commit is contained in:
parent
ee10c7ce70
commit
81023bbde2
1 changed files with 19 additions and 0 deletions
19
include/mesytec-mnode/mnode_string.hpp
Normal file
19
include/mesytec-mnode/mnode_string.hpp
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
#ifndef E7FD4517_4FF5_4BDA_9AE4_95308A37554D
|
||||||
|
#define E7FD4517_4FF5_4BDA_9AE4_95308A37554D
|
||||||
|
|
||||||
|
#include <regex>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace mesytec::mnode
|
||||||
|
{
|
||||||
|
|
||||||
|
template <typename OutputIt>
|
||||||
|
void split_string(const std::string &str, const std::regex &re, OutputIt out)
|
||||||
|
{
|
||||||
|
std::sregex_token_iterator it(str.begin(), str.end(), re, -1);
|
||||||
|
std::copy(it, std::sregex_token_iterator(), out);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace mesytec::mnode
|
||||||
|
|
||||||
|
#endif /* E7FD4517_4FF5_4BDA_9AE4_95308A37554D */
|
Loading…
Reference in a new issue