Browse Source

Merge pull request #338 from ONE-LOGIC/master

char replacement if non default quoteChar
pull/342/head
Matt Holt 9 years ago committed by GitHub
parent
commit
a72309fc66
  1. 6
      papaparse.js

6
papaparse.js

@ -1128,7 +1128,7 @@ @@ -1128,7 +1128,7 @@
if (quoteSearch === inputLen-1)
{
// Closing quote at EOF
var value = input.substring(cursor, quoteSearch).replace(quoteCharRegex, '"');
var value = input.substring(cursor, quoteSearch).replace(quoteCharRegex, quoteChar);
return finish(value);
}
@ -1142,7 +1142,7 @@ @@ -1142,7 +1142,7 @@
if (input[quoteSearch+1] === delim)
{
// Closing quote followed by delimiter
row.push(input.substring(cursor, quoteSearch).replace(quoteCharRegex, '"'));
row.push(input.substring(cursor, quoteSearch).replace(quoteCharRegex, quoteChar));
cursor = quoteSearch + 1 + delimLen;
nextDelim = input.indexOf(delim, cursor);
nextNewline = input.indexOf(newline, cursor);
@ -1152,7 +1152,7 @@ @@ -1152,7 +1152,7 @@
if (input.substr(quoteSearch+1, newlineLen) === newline)
{
// Closing quote followed by newline
row.push(input.substring(cursor, quoteSearch).replace(quoteCharRegex, '"'));
row.push(input.substring(cursor, quoteSearch).replace(quoteCharRegex, quoteChar));
saveRow(quoteSearch + 1 + newlineLen);
nextDelim = input.indexOf(delim, cursor); // because we may have skipped the nextDelim in the quoted field

Loading…
Cancel
Save