1
0
Fork 0

StringUtils: Fixed StringSplitWithQuotes().

The function would crash when given a string that started with the delimiter.
This commit is contained in:
Mattes D 2015-05-10 21:34:31 +02:00
parent 87f1cf5622
commit b356419a07
1 changed files with 7 additions and 0 deletions

View File

@ -150,6 +150,13 @@ AStringVector StringSplitWithQuotes(const AString & str, const AString & delim)
while ((cutAt = str.find_first_of(delim, Prev)) != str.npos)
{
if (cutAt == Prev)
{
// Empty string due to multiple whitespace / whitespace at the beginning of the input
// Just skip it
Prev = Prev + 1;
continue;
}
AString current = str.substr(Prev, cutAt - Prev);
if ((current.front() == '"') || (current.front() == '\''))
{