From d8ab99e944f90dffcaa597b030c6475a675679b2 Mon Sep 17 00:00:00 2001 From: flx5 Date: Wed, 11 Mar 2015 19:52:49 +0100 Subject: Fixed issue with quotes not appearing in pairs --- src/StringUtils.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/StringUtils.cpp b/src/StringUtils.cpp index 343f93ce3..47fb6e5a1 100644 --- a/src/StringUtils.cpp +++ b/src/StringUtils.cpp @@ -146,6 +146,7 @@ AStringVector StringSplitWithQuotes(const AString & str, const AString & delim) size_t cutAt = 0; size_t Prev = 0; + size_t cutAtQuote = 0; while ((cutAt = str.find_first_of(delim, Prev)) != str.npos) { @@ -153,11 +154,11 @@ AStringVector StringSplitWithQuotes(const AString & str, const AString & delim) if ((current.at(0) == '"') || (current.at(0) == '\'')) { Prev += 1; - cutAt = str.find_first_of(current.at(0), Prev); - if (cutAt != str.npos) + cutAtQuote = str.find_first_of(current.at(0), Prev); + if (cutAtQuote != str.npos) { - current = str.substr(Prev, cutAt - Prev); - cutAt += 1; + current = str.substr(Prev, cutAtQuote - Prev); + cutAt = cutAtQuote + 1; } } -- cgit v1.2.3