Skip to content

Commit

Permalink
Removing blank lines in CSV Parser
Browse files Browse the repository at this point in the history
  • Loading branch information
kmonico committed Aug 11, 2011
1 parent ca8369a commit 82e4a9f
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions WeaveData/src/weave/data/CSVParser.as
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,12 @@ package weave.data

// if there is more than one row and last row is empty,
// remove last row assuming it is there because of a newline at the end of the file.
while (csvDataArray.length > 1)
for (var iRow:int = csvDataArray.length - 1; iRow >= 0; --iRow)
{
var lastRow:Array = csvDataArray[csvDataArray.length - 1];
if (lastRow.length == 1 && lastRow[0] == '')
csvDataArray.pop();
else
break;
var dataLine:Array = csvDataArray[iRow];

if (dataLine.length == 1 && dataLine[0] == '')
csvDataArray.splice(iRow, 1);
}

return csvDataArray;
Expand Down

0 comments on commit 82e4a9f

Please sign in to comment.