mirror of
https://github.com/rkd77/elinks.git
synced 2025-05-18 00:48:57 -04:00
[xhr] Small rewrite of explode
This commit is contained in:
parent
5657e59006
commit
0d9b1aa1cb
@ -518,10 +518,14 @@ explode(const std::string& s, const char& c)
|
|||||||
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for (auto n:s) {
|
for (auto n:s) {
|
||||||
if (found || (n != c)) {
|
if (found) {
|
||||||
|
buff += n;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (n != c) {
|
||||||
buff += n;
|
buff += n;
|
||||||
}
|
}
|
||||||
else if (!found && n == c && buff != "") {
|
else if (n == c && buff != "") {
|
||||||
v.push_back(buff);
|
v.push_back(buff);
|
||||||
buff = "";
|
buff = "";
|
||||||
found = true;
|
found = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user