Skip to content

Commit

Permalink
Fix string splitter to get last line
Browse files Browse the repository at this point in the history
  • Loading branch information
dpriedel committed Nov 8, 2017
1 parent b21c382 commit 30853da
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/FormFileRetriever.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,13 @@ std::vector<std::string_view> split_string(const std::string_view& string_data,
for (auto it = 0; it != string_data.npos; ++it)
{
auto pos = string_data.find(delim, it);
if (pos == std::string_view::npos)
break;
results.emplace_back(string_data.substr(it, pos - it));
if (pos != string_data.npos)
results.emplace_back(string_data.substr(it, pos - it));
else
{
results.emplace_back(string_data.substr(it));
break;
}
it = pos;
}
return results;
Expand Down

0 comments on commit 30853da

Please sign in to comment.