From 9464c15f54a175ea907baeea1287e20d262b9224 Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Thu, 1 Dec 2011 13:51:50 +0000 Subject: docs for ->cols, configurable separtor --- it_pipe.class | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/it_pipe.class b/it_pipe.class index f1cdf76..36e4f63 100644 --- a/it_pipe.class +++ b/it_pipe.class @@ -132,11 +132,16 @@ function ED() return $this; } -function cols($collist) +/** + * Convert every line into an object with named columns + * @param collist comma separator column name list + * @param separator split character ["\t"] + */ +function cols($collist, $separator = "\t") { $keys = explode(",", $collist); foreach ($this->lines as $idx => $line) - $this->lines[$idx] = (object)array_combine($keys, explode("\t", $line)); + $this->lines[$idx] = (object)array_combine($keys, explode($separator, $line)); return $this; } -- cgit v1.2.3