- the correct fix for issue #328.

This commit is contained in:
Fledge68 2023-01-22 16:14:05 -06:00
parent 363caf4794
commit 2fd07be7a8
2 changed files with 14 additions and 0 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 MiB

After

Width:  |  Height:  |  Size: 4.4 MiB

View File

@ -105,6 +105,11 @@ vector<string> stringToVector(const string &text, char sep)
{
vector<string> v;
if (text.empty()) return v;
u32 count = 1;
for (u32 i = 0; i < text.size() - 1; ++i)// minus 1 in case the last character is sep
if (text[i] == sep)
++count;
v.reserve(count);
string::size_type off = 0;
string::size_type i = 0;
do
@ -115,6 +120,8 @@ vector<string> stringToVector(const string &text, char sep)
string ws(text.substr(off, i - off));
v.push_back(ws);
off = i + 1;
if(off == text.size())// in case the last character is sep
break;
}
else
v.push_back(text.substr(off));
@ -126,6 +133,11 @@ vector<wstringEx> stringToVector(const wstringEx &text, char sep)
{
vector<wstringEx> v;
if (text.empty()) return v;
u32 count = 1;
for (u32 i = 0; i < text.size() - 1; ++i)// minus 1 in case the last character is sep
if (text[i] == sep)
++count;
v.reserve(count);
wstringEx::size_type off = 0;
wstringEx::size_type i = 0;
do
@ -136,6 +148,8 @@ vector<wstringEx> stringToVector(const wstringEx &text, char sep)
wstringEx ws(text.substr(off, i - off));
v.push_back(ws);
off = i + 1;
if(off == text.size())// in case the last character is sep
break;
}
else
v.push_back(text.substr(off));