Splitting an empty string now returns an empty vector

This commit is contained in:
Maxime Coste 2015-11-19 00:17:18 +00:00
parent 9656f088e7
commit 784ab635ee

View File

@ -44,6 +44,9 @@ Vector<String> split(StringView str, char separator, char escape)
Vector<StringView> split(StringView str, char separator) Vector<StringView> split(StringView str, char separator)
{ {
Vector<StringView> res; Vector<StringView> res;
if (str.empty())
return res;
auto beg = str.begin(); auto beg = str.begin();
for (auto it = beg; it != str.end(); ++it) for (auto it = beg; it != str.end(); ++it)
{ {