summaryrefslogtreecommitdiff
path: root/it_pipe.class
diff options
context:
space:
mode:
authorUrban Müller2011-02-23 16:19:54 +0000
committerUrban Müller2011-02-23 16:19:54 +0000
commit18d130ab98c55594cc9b01d76292e2be140c5f4e (patch)
treed6fffcfe115a4c2c47e8e87b33ec04881666619d /it_pipe.class
parentc616e7b840258e98a86afd103efd8b1f152ebf66 (diff)
downloaditools-18d130ab98c55594cc9b01d76292e2be140c5f4e.tar.gz
itools-18d130ab98c55594cc9b01d76292e2be140c5f4e.tar.bz2
itools-18d130ab98c55594cc9b01d76292e2be140c5f4e.zip
handle comma separation
Diffstat (limited to 'it_pipe.class')
-rw-r--r--it_pipe.class5
1 files changed, 3 insertions, 2 deletions
diff --git a/it_pipe.class b/it_pipe.class
index b3c9d39..838fa39 100644
--- a/it_pipe.class
+++ b/it_pipe.class
@@ -92,12 +92,13 @@ function cols($collist)
*/
function csv()
{
- $schema = explode("\t", it::replace(array('"' => ''), trim(array_shift($this->lines), "#\n")));
+ $splitchar = it::match("\t", $this->lines[0]) ? "\t" : ",";
+ $schema = str_getcsv(trim(array_shift($this->lines), "#\n"), $splitchar, '"'); # could do a function_exists('str_getcsv') here...
$oldlocale = setlocale(LC_CTYPE, 'de_CH.iso-8859-1');
foreach ($this->lines as $line)
- $records[] = (object)array_combine($schema, str_getcsv($line, "\t", '"')); # could do a function_exists('str_getcsv') here...
+ $records[] = (object)array_combine($schema, str_getcsv($line, $splitchar, '"')); # could do a function_exists('str_getcsv') here...
setlocale(LC_CTYPE, $oldlocale);