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