mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-15 17:41:45 +00:00
Simplify Tokenize(): nicer looking code = better code
This commit is contained in:
@@ -791,19 +791,12 @@ void FairMQChannel::Tokenize(std::vector<std::string>& output,
|
||||
using namespace std;
|
||||
size_t start = 0;
|
||||
size_t end = input.find_first_of(delimiters);
|
||||
if (end == string::npos)
|
||||
{
|
||||
output.push_back(input.substr(start, input.length()));
|
||||
}
|
||||
else do
|
||||
while (end != string::npos)
|
||||
{
|
||||
output.push_back(input.substr(start, end-start));
|
||||
start = ++end;
|
||||
end = input.find_first_of(delimiters, start);
|
||||
if (end == string::npos)
|
||||
{
|
||||
output.push_back(input.substr(start, input.length()));
|
||||
}
|
||||
} while (end != string::npos);
|
||||
}
|
||||
output.push_back(input.substr(start));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user