Skip to content

Commit

Permalink
Merge pull request #60 from JeromeMartinez/Update
Browse files Browse the repository at this point in the history
Correct handle of load from CSV with quotes, fixes
  • Loading branch information
JeromeMartinez committed Jul 4, 2017
2 parents bc8840e + 156af7e commit 508085e
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions Source/ZenLib/ZtringListList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ void ZtringListList::Write(const Ztring &ToWrite)
while (i<l)
{
//Quote
if (i+Quote_Size<l)
if (i+Quote_Size<=l)
{
bool IsQuote=true;
for (size_t j=0; j<Quote_Size; j++)
Expand All @@ -312,7 +312,7 @@ void ZtringListList::Write(const Ztring &ToWrite)
if (IsQuote)
{
//Double quote
if (i+Quote_Size*2<l)
if (i+Quote_Size*2<=l)
{
IsQuote=false;
for (size_t j=0; j<Quote_Size; j++)
Expand All @@ -338,7 +338,7 @@ void ZtringListList::Write(const Ztring &ToWrite)
if (!q)
{
//Carriage return
if (i+Separator0_Size<l)
if (i+Separator0_Size<=l)
{
bool IsSeparator0=true;
for (size_t j=0; j<Separator0_Size; j++)
Expand All @@ -359,7 +359,7 @@ void ZtringListList::Write(const Ztring &ToWrite)
}

//Carriage return
if (i+Separator1_Size<l)
if (i+Separator1_Size<=l)
{
bool IsSeparator1=true;
for (size_t j=0; j<Separator1_Size; j++)
Expand All @@ -380,7 +380,12 @@ void ZtringListList::Write(const Ztring &ToWrite)
}

if (y>=size())
{
size_t PreviousSize=size();
resize(y+1);
for (size_t j=0; j<=y; j++)
operator[](j).Separator_Set(0, Separator[1]);
}
ZtringList& Line=operator[](y);
if (x>=Line.size())
Line.resize(x+1);
Expand Down

0 comments on commit 508085e

Please # to comment.