mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
RiaStdStringTools. Minor refactoring
This commit is contained in:
parent
8dd804b5ee
commit
c959dbb850
@ -40,19 +40,23 @@ public:
|
||||
|
||||
private:
|
||||
template <class Container>
|
||||
static void splitByDelimiter(const std::string& str, Container& cont, char delimiter = ' ')
|
||||
{
|
||||
std::stringstream ss(str);
|
||||
std::string token;
|
||||
while (std::getline(ss, token, delimiter))
|
||||
{
|
||||
if (token.find_first_not_of(delimiter) != std::string::npos)
|
||||
{
|
||||
cont.push_back(token);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void splitByDelimiter(const std::string& str, Container& cont, char delimiter = ' ');
|
||||
static size_t findCharMatchCount(const std::string& s, char c);
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//==================================================================================================
|
||||
template <class Container>
|
||||
void RiaStdStringTools::splitByDelimiter(const std::string& str, Container& cont, char delimiter)
|
||||
{
|
||||
std::stringstream ss(str);
|
||||
std::string token;
|
||||
while (std::getline(ss, token, delimiter))
|
||||
{
|
||||
if (token.find_first_not_of(delimiter) != std::string::npos)
|
||||
{
|
||||
cont.push_back(token);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user