summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUrban Müller2011-03-14 18:25:12 +0000
committerUrban Müller2011-03-14 18:25:12 +0000
commit827499af71ba1f6fa6e65818768b9317623aeb1d (patch)
tree46c75c94842e7ae3f7b96081ac10fcbbd479f082
parent4340602f5f3fbcd6874b7cba101ed0fea1feb55a (diff)
downloaditools-827499af71ba1f6fa6e65818768b9317623aeb1d.tar.gz
itools-827499af71ba1f6fa6e65818768b9317623aeb1d.tar.bz2
itools-827499af71ba1f6fa6e65818768b9317623aeb1d.zip
handle ; as split char
-rw-r--r--it_pipe.class3
1 files changed, 2 insertions, 1 deletions
diff --git a/it_pipe.class b/it_pipe.class
index 3bfcfff..0567ec3 100644
--- a/it_pipe.class
+++ b/it_pipe.class
@@ -95,7 +95,8 @@ function cols($collist)
*/
function csv()
{
- $splitchar = it::match("\t", $this->lines[0]) ? "\t" : ",";
+ $counts = count_chars($this->lines[0]);
+ $splitchar = $counts[ord("\t")] ? "\t" : ($counts[ord(";")] > $counts[ord(",")] ? ";" : ",");
$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');