SImplify separator inference code (#903)
This commit is contained in:
parent
df1085505c
commit
f26023586e
|
@ -155,7 +155,7 @@ class Csv extends BaseReader
|
|||
return;
|
||||
}
|
||||
|
||||
$potentialDelimiters = [',', ';', "\t", '|', ':', ' '];
|
||||
$potentialDelimiters = [',', ';', "\t", '|', ':', ' ', '~'];
|
||||
$counts = [];
|
||||
foreach ($potentialDelimiters as $delimiter) {
|
||||
$counts[$delimiter] = [];
|
||||
|
@ -258,11 +258,8 @@ class Csv extends BaseReader
|
|||
$line = preg_replace('/(' . $enclosure . '.*' . $enclosure . ')/U', '', $line);
|
||||
|
||||
// See if we have any enclosures left in the line
|
||||
$matches = [];
|
||||
preg_match('/(' . $enclosure . ')/', $line, $matches);
|
||||
|
||||
// if we still have an enclosure then we need to read the next line as well
|
||||
if (count($matches) > 0) {
|
||||
if (preg_match('/(' . $enclosure . ')/', $line) > 0) {
|
||||
$line = $this->getNextLine($line);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue